I in stalled jdk1.3.0_02 on my win98.and my file is in c:\jdk1.3.0_02\bin; I set the path as c:\jdk1.3.0_02\bin and the classpath as c:\jdk1.3.0_02 and it's compiling fine.but when i try to run it iam getting Exception in thread "main" java.lang.NoClassDefFoundError: Hello1 (wrong name: h ello1) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11 1) 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)
what might be the problem?Do i need to install jre separately. so, how to solve this problem?
Try setting up your classpath like this: classpath = c:\jdk1.3.0_02\lib;. Notice the inclusion of the lib directory before the semicolon. Also, the period '.' after the semicolon means the current directory that your in. You could just as well type in the current directory instead of using the period, but both will work for DOS and UNIX. You could also set the classpath from the command prompt when you run the java program, like this: java -classpath c:\jdk1.3.0_02\lib;. Hello1
Java is cAsE sEnSiTiVe You are running Hello1, but your class file is actually hello1 I've never run across that before. I didn't think about Windows' case-insensitivity fouling up the java command. I would have thought it would error out before main(). That is, it would immediately say something like class not found, and not have such a large stack trace.
Learn something new all the time!
posted 19 years ago
I did set the classpath as classpath = c:\jdk1.3.0_02\lib;. and also as java -classpath c:\jdk1.3.0_02\lib;. Hello1 but still same result. what is the solution
Look........................................................................\/..........................\/ Exception in thread "main" java.lang.NoClassDefFoundError:Hello1 (wrong name: hello1) < insert grumble about variable-width fonts > [This message has been edited by Mike Curwen (edited March 30, 2001).] [This message has been edited by Mike Curwen (edited March 30, 2001).]
posted 19 years ago
o.k. i got it.let us go to the next problem. iam trying to compile other Hello12 program in the same directory bin.but while compiling it's showing cannot read :Hello12.java. i don't know what is happening.the file is getting stored as a textfile and not as a java file.