You can run Java in cmd, but you can't use Javac solution __java

Source: Internet
Author: User
Cause: When Java is installed, the path of the JDK and the path of the JRE are selected as a result of overwriting. At this time you can not find Tools.jar and Dt.jar under LIB. Solution: 1. First uninstall Java, uninstall is very easy, directly to the two Java-related programs to uninstall the line (with Windows with the uninstall). After unloading you will also find that the original Java folder is empty.

2. Reinstall
Create a new Java folder in D and create two new folders under the Java file, named JDK and JRE, respectively.
3. Double-click the program to install, installation has two times the opportunity to choose the path, the first is to let you choose JDK installation path, select for D:\java\jdk, the second is to let you select the JRE installation path, select for D:\java\jre
4. After installation, the configuration of environment variables, computer right click Properties,-Advanced system settings-environment variables-Select the following system variables

5. New
Variable name: Path
Variable Value: C:\programdata\oracle\java\javapath;%java_home%\bin;%java_home%\jre\bin
New
Variable name: java_home
Variable Value: D:\JAVA\JDK
New
Variable name: ClassPath
Variable value:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
The reason for setting the java_home to D:\java\jdk is because the Dt.jar,tools.jar generated during the installation is placed in the D:\java\jdk\lib directory, which is something that is JDK. Classpath use Java_home to make a relative path. So java_home must be the installation directory of the JDK, and there is no semicolon behind it, and if it has a semicolon, then%java_home%\lib\dt.jar is not a directory. Just try again, OK.

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.