You can run Java in cmd, but you cannot run the Javac command

Source: Internet
Author: User

You can run Java in cmd, but you are prompted when you run the javac command: ' Javac ' is not an internal or external command, or a program or batch file that can be run.

Cause: When installing Java, the path of the JDK and the path of the JRE are chosen to be the same, resulting in overwriting. At this time you can not find Tools.jar and Dt.jar under Lib.

Solve:

1) Uninstall Java, directly with Windows to uninstall the two Java-related programs;

2) Reinstall Java, install two times the opportunity to select the path, the first time is to let you choose the JDK installation path, choose the C:\Program files\java\jdk1.8.0_144, the second is to let you choose the JRE installation path, select as C:\Program Files\java\jre (new Folder JRE in Java directory);

3) Environment Configuration (Control Panel-system-Advanced system settings-environment variables)

Variable name: Path
Variable Value: C:\Program files\java\jdk1.8.0_144\bin

Open cmd, input Java,javac and java-verbose are successful, it means the installation is successful;

About the environment configuration, there are many different versions of the Internet, well, one night to try, try to doubt life ... I do not know whether it is only I can not, but write a few references (in case my computer is defective)

The first: Add the two directories of your own JDK to the front of the PATH environment variable path= C:\ProgramFiles\Java\jdk1.7.0_67\bin; C:\Program Files\java\jdk1.7.0_67\bin\jre\bin;

Second: Create a new variable (create a new Java folder on the D disk, create a new two folder under the Java file, named JDK and JRE respectively, the installation path is selected as D:\JAVA\JDK,D:\JAVA\JRE)

Variable name: Path
Variable Value: C:\programdata\oracle\java\javapath;%java_home%\bin;%java_home%\jre\bin
Variable name: java_home
Variable Value: D:\JAVA\JDK
Variable name: ClassPath
Variable value:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;

You can run Java in cmd, but you cannot run the Javac command

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.