× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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

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

HTH,
Gary

-----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 testjava.java, which successfully compiles into
testjava.class.

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:
testjava.class
at java.net.URLClassLoader.findClass(URLClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:639)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:605)

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

.
:/java/dom4j/dom4j-1.6.1.jar
:/java/poi3.7/poi-3.7-20101029.jar
:/java/poi3.7/poi-scratchpad-3.7-20101029.jar
:/java/poi3.7/poi-ooxml-3.7-20101029.jar
:/java/poi3.7/poi-ooxml-schemas-3.7-20101029.jar
:/java/xmlbeans/jsr173_1.0_api.jar
:/java/xmlbeans/xbean.jar

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 testjava.java')
Command ended normally with exit status 0.

and

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
runtime?


--*
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,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 by midrange.com 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.