This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi there, I decided to try learning Java, so I installed some old magazine cover CD software: Visual Cafe 2 and JBuilder. The first thing I discovered was that Java has changed a lot since then, so I bought Bruce Eckel's Thinking in Java and downloaded and installed the Java SDK from www.sun.com. I tried compiling and running the first program from TIJ. It compiled fine, but gave this output when trying to run it: <CONSOLE> F:\JDK\tijcode\c02>java hellodate Exception in thread "main" java.lang.NoClassDefFoundError: hellodate (wrong name: HelloDate) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111) at java.net.URLClassLoader.defineClass(URLClassLoader.java:248) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:297) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286) at java.lang.ClassLoader.loadClass(ClassLoader.java:253) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313) F:\JDK\tijcode\c02> </CONSOLE> Looking at the PATH and CLASSPATH settings, I found settings for Vis Cafe, etc. so I uninstalled them, then uninstalled and reinstalled JDK. I still get this problem. I am running NT, and PATH is set to this: PATH=D:\WINNT\system32;D:\WINNT;D:\PROGRA~1\MICROS~1\Office;f:\jdk\jdk1.3\bin;C:\WIN95;C:\WIN95\COMMAND;C:\DOS6_22 CLASSPATH is not set. I've been hammering at this for hours now. What am I doing wrong? Regards, Jay Ayliff
Where abouts do you set the classpath. I am using XP and am compiling using the command prompt. I have defined a ClassPath under the environment variables in the properties of my computer. Also i have tried the line before compiling at the command prompt "set CLASSPATH=C:\jdk1.3.1\bin\" The only way i can compile is to write "java -classpath . HelloDate"