I had java in my system it used to work properly, but when I reformatted the system, I tried to load java again ,then I couldn't able to load it properly I am getting these errors!! my java is in JAVA_HOME:C:\Sun\AppServer\jdk; CLASSPATH:C:\Sun\AppServer\jdk\bin; Path:C:\Sun\AppServer\jdk\bin; on command prompt: if give command >java it's working properly; but when I give "javac" I am getting the following errors >javac Error opening registry key 'Software\JavaSoft\Java Runtime Environment' Error: could not find java.dll Error: could not find Java 2 Runtime Environment.
I am getting a new error i.e, Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld Press any key to continue . . . I checked my path&classpath and JAVA_HOME everything is semms to be ok An improperly configured CLASSPATH will cause this problem. What is your CLASSPATH setting? Does it include the current working directory specified with a period? Are you 100% certain that the HelloWorld.class file was generated during compilation?
forgetting to include "." in your classpath can cause head-aches. one way to see if java installed properly is to run a class and explicitly stating its class path. ex. your class is here: c:\java\hello.class so run it like this: java -cp c:\java\ hello even if you are inside the directory where your class is present, without explicitly specifying the classpath you would get an error. ex. if you havent change your classpath to include the ".". doing this wont work. c:\java\java hello