I'm a little confused. I can compile and run: public class test { public static void main(String[] args) { System.out.println("hello world!"); } } but I can compile, but can't run: public class HelloWorld { public static void main(String[] args) { System.out.println("hello world!"); } } I get this exception: Exception in thread "main" java.lang.NoSuchMethodError: main I also can compile but can't run: public class helloworld { public static void main(String[] args) { System.out.println("hello world!"); } } I get this exception: Exception in thread "main" java.lang.NoClassDefFoundError: helloworld (wrong name: HelloWorld) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:502) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:250) at java.net.URLClassLoader.access$100(URLClassLoader.java:54) at java.net.URLClassLoader$1.run(URLClassLoader.java:193) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:186) at java.lang.ClassLoader.loadClass(ClassLoader.java:299) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) at java.lang.ClassLoader.loadClass(ClassLoader.java:255) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315) What gives? Thanks Andrew
Make sure that your "HelloWorld" class is in a file named "HelloWorld.java", and your "helloworld" class is in a file named "helloworld.java". Case matters.
...Except to Windows file names. The OS sometimes gets a little bit fnicky about actually recognizing a change to a file name if the only thing that you change is the case. You may need to copy the file to another directory with the new case, delete the old file, and then move the copied file to the directory where you want it. Basic summary: Java cares about case, but Windows doesn't.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.