×

Loading...

Topic

  • 工作学习 / IT技术讨论 / Hi,Jabber, I can't set classpath correctly. Pls help
    Dear Jabber,
    I'm benefiting from your experience and knowledge. I really appreciate your kind help to us.
    I'm a begginner of Java. When I used the command c:\javaexec>java HelloWorld to run the program, it gave the following error message: Exception in thread “main” java.lang.NoClassDefFoundError: HelloWorld.
    I've read your replies to Java environment setting. However,I still can't work it out. I have both jdk1.3 and Jbuilder3.5 installed in my computer.
    The following is the environment I set in JavaDos.bat (I run it when I enter DOS)
    set path=c:\jdk1.3\bin;c:\jdk1.3\lib;c:\jdk1.3\jre\bin
    set classpath=.;c:\jdk1.3\SRC.JAR
    By the way, I can't find a directory like
    C:\J2SDKEE1.3\LIB\J2EE.JAR in my computer. Pls help me out.
    Thank you very much!

    Yours truly
    • try: set classpath=.;c:\jdk1.3\lib\
    • Use default directory
      I suggest you unintall you JDK1.3 and
      delete the remnant directory. Restart your machine. Install again. Install JDK to the directory such as C:\jdk1.3. Do not change it to other directory.

      Your probiem is a classpath problem.
      To check your current classpath, you can type
      echo %CLASSPATH%.

      It is good to use BAT file. To set PATH, you say set PATH=C:\jdk1.3\bin; %PATH%.
      To set CLASSPATH, you say
      set CLASSPATH=.; %CLASSPATH%.
      Remider: JDK1.2 and JDK1.3 can find System classes such java.lang.String automatically.

      I guess you problem is as follows:
      You put your Hello.java and Hello.class
      in some directory such as C:\jdk1.3\bin or
      C:\myprojects. If you run your Java example at C:\, definitely your JVM cannot find Hello.class. Reminder again: "." means the current directory.


      Jbuilkder has a closed envirenment and it does not interfere with JDK1.3,

      Jdk1.3 does not contain j2ee.jar. You don't need j2ee at present because you are a beginner.