Try to take the ".class" off of your java command so it's

qsh cmd('java -classpath $CLASSPATH testjava')


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Peter Dow
Sent: Monday, July 18, 2011 8:02 PM
To: Java Programming on and around the iSeries / AS400
Subject: NoClassDefFoundError: testjava.class

I have a java program, which successfully compiles into

Both of these are in my current directory, /home/pdow.

When I try to run the program with

qsh cmd('javap -s -public -classpath $CLASSPATH testjava.class')

I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:
testjava.class Caused by: java.lang.ClassNotFoundException:
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(

This program uses POI version 3.7, and the classpath is:


Googling tells me that "NoClassDefFoundError" means the class was found
during compile time, but is not present at runtime. The environment did
not change between

qsh cmd('javac -classpath $CLASSPATH')
Command ended normally with exit status 0.


qsh cmd('java -classpath $CLASSPATH testjava.class')
Command ended normally with exit status 1.

I also tried

qsh cmd('javap -s -public -classpath $CLASSPATH testjava.class')
Command ended normally with exit status 1.

which simply got

ERROR:Could not find testjava.class

So what's going on? Why can the compiler find it, but not the java

Peter Dow*/
Dow Software Services, Inc.
909 793-9050
pdow@xxxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxxx>


This is the Java Programming on and around the IBM i (JAVA400-L) mailing
list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.