Compiler Error - 'Error: Could not find or load main class com.sun.tools.javac.Main'

前端 未结 7 2081
眼角桃花
眼角桃花 2020-12-16 16:03

I just started learning Java and I installed JDK on my computer, but now I am trying the SIMPLIST of Java and its not compiling. I installed JDK on C:/Java/jdk7/

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-16 16:57

    Your source code is OK.

    Error log means could not find the class included tools.jar. Tools.jar is always included JDK. So, I guess you use a wrong JDK. So, you try to write javac full path you installed.
    example) "C:\Program Files\java\jdk1.7.0_25\bin\javac" test.java (windows)

    If it has worked, JDK in the path variable is wrong. So, you add the path "C:\Program Files\java\jdk1.7.0_25\bin\"(e.g) to the path variable.
    (See http://www.computerhope.com/issues/ch000549.htm)

    If it doesn't worked, you check ...\jdk1.7.0_25\lib\tools.jar. If it doesn't exists, it's wrong. So, you retry to install.
    If it exists, uhmmm, I don't know. I recommend re-install to you.

提交回复
热议问题