Hi,
I've been using java for 3 years now. So I tried to compile a simple java program on another computer. But it just doesnt work. I always get the dreaded noclassdeffrounderror. I coppied the cmd.exe into my JDK directory (the one that contains javac.exe, java.exe, javaw.exe, etc) and saved my program there also.
HelloWorld.java:
class HelloWorld{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
I get this exception:
C:\Documents and Settings\Guest.DC2W2R61.002\Desktop\Alex\JDK>javac -cp . HelloWorld.java
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
I know this works on my laptop, done it countless times...