aspose file tools*
The moose likes Beginning Java and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic
Author

NoClassDefFoundError

Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136
    
    1
I am trying to run a very simple class.

I put it in "package myJava;"

it is in the directory myJava which is below my home directory (/home/redsmith).

The CLASSPATH has in it:
CLASSPATH=:/home/redsmith:/home/redsmith/myJava:.:/home/redsmith/myJava/jarFiles/junit-4.5.jar

this is the complete "program":



and this is the output:
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
Try removing "/home/redsmith/myJava" from the classpath. Also, what's the first colon doing in there (right after the "CLASSPATH=")? Remove that, too.
Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136
    
    1
Originally posted by Ulf Dittmer:
Try removing "/home/redsmith/myJava" from the classpath. Also, what's the first colon doing in there (right after the "CLASSPATH=")? Remove that, too.


The extra : came from having CLASSPATH=${CLASSPATH}:.... and CLASSPATH was empty. I removed the extra colon and I removed the directory as you suggested. I still get the error:




the Z-shell file that I am executing has in it:

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19063
    
  40

try changing PGM to myJava.testJunit

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136
    
    1
Originally posted by Henry Wong:
try changing PGM to myJava.testJunit

Henry


I made that change and the error changed:



[ August 12, 2008: Message edited by: Red Smith ]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19063
    
  40

The main() method takes a string array -- you have it defined as a single string parameter.

Henry
Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136
    
    1
Originally posted by Henry Wong:
The main() method takes a string array -- you have it defined as a single string parameter.

Henry


D'oh!!

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError