PDA

View Full Version : Java doesn't work


feathers
February 6th, 2006, 02:47 PM
Whatever I do, I always get this message in my simple "hello world" programme:
Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

My sourcecode:



class Main
{
public static void main (String[] args)
{
System.out.println( "Hello, world!" );
}
}

This is the command to start it: java Main.class
I installed various jre's and sdk's and set them with update-alternatives. The funny thing is, it works in Eclipse, I mean I can start the class in Eclipse but I cannot do this on the console. This is the case with several kubuntu computers I have checked.
Who can help? Thanks!

Viro
February 6th, 2006, 03:40 PM
You start it by typing java Main (without the .class).

feathers
February 7th, 2006, 07:36 AM
Thanks, that was exactly the problem.