This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have configured java home, the bin and the lib folders. also added the working folder to the classpath. i also tried to go into the directory containing the .class file and run the same with the java command. However, i get the same error.
wht am i missing?
SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.
Java Developer, Thailand
Originally posted by somkiat puisungnoen: [QB][/QB]
This is the text of the error message that i receive :
C:\Jayashree\Examples\printHTML\classes\test\print>java printHTML Exception in thread "main" java.lang.NoClassDefFoundError: printHTML (wrong name : test/print/printHTML) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) 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)
hi Gopal , i think so, your class printHTML is under package test.print. you have to run your class from C:\Jayashree\Examples\printHTML\classes folder and you have to give the following command java test.print.printHTML. now it will work properly.
Regards<br />Pitchaimani Raju
Joined: Jul 04, 2003
Please post your code to solve this problem.
Joined: Jul 04, 2003
Originally posted by Vedhas Pitkar: Is the class public?
I think, public Class name in source code is not "printHTML".