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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefinationFoundError" Watch "NoClassDefinationFoundError" New topic
Author

NoClassDefinationFoundError

D vaibhav deshmukh
Greenhorn

Joined: Aug 03, 2007
Posts: 7
public class WTest
{
static Integer y;
static int x;
public static void main(String[] args)
{
y = new Integer(143);
x = y.intValue();
x++;
y = new Integer(x);
System.out.println("Y = " +y);
}
}


I am able to compile the above programm fine. But, when I tried to run it is throwing a statement saying:

"Execption in thread "main" java.lang.NoClassDefinationFoundError : WTest"

Why???

Please reply.....
Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136
    
    1
Originally posted by D vaibhav deshmukh:




I am able to compile the above program fine. But, when I tried to run it is throwing a statement saying:

"Execption in thread "main" java.lang.NoClassDefinationFoundError : WTest"

Why???

Please reply.....


That code worked for me (prints 144) without error. Are you typing "java WTest" or "java wtest"? What you type after java has to match the case of the class in the file (and the filename) exactly.
[ August 11, 2007: Message edited by: Red Smith ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

It looks like the command is using the correct case, because the exception message says "WTest" (assuming this is the exact message).

So my bet is that there is a system classpath set that does not include a dot (.) for the current directory. Try running with:

java -classpath . WTest

If this works, then you should consider removing the system classpath. Or if it contains something you really need, then add a dot for the current directory.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefinationFoundError