How to troubleshoot a problem where the Java environment variable settings do not work

Source: Internet
Author: User

Learn about the installation of the Java Development environment (http://www.maiziedu.com/group/article/11995/) in reading, which involves Java environment variable settings, but the previous time I installed the JDK under the win7 system , always pops up "Javac is not an internal command or external command, Also not a program or batch file to run " prompt box. Toss for a long time, and finally find a solution, now the small part of this method to share to everyone, hope to be useful to you, specific collation as follows:

First step: InstallJdk-6u26-windows-x32.exe, the path is the default path, and the next step is until the installation is complete.
Step Two: Set environment variables:
1, Enter the environment variable setting method, which is only forWindows7:"Computer"Right-click"Properties"--"Advanced system Settings"--"Advanced"--"Environment Variables"Open the Environment Variables Settings window.
2, in the following"System Environment Variables"Settings window, click"New", establishJava_homevariables:    
Variable name:Java_home
Variable Value:C:\Program files\java\jdk1.6.0_26
3, in the following"System Environment Variables"Settings window, click"New", establishCLASSPATHvariables:    
Variable name:CLASSPATH
Variable Value:C:\Program Files\java\jdk1.6.0_26\lib\dt.jar; C:\Program Files\java\jdk1.6.0_26\lib\tools.jar; (note semicolon)
4, in the following"System Environment Variables"Settings window, double-click"PATH"variable, added after the value of the variable:   ; C:\Program Files\java\jdk1.6.0_26\bin; (Note Semicolon)
after setting the environment variable,cmdInput inJavaccommand not available, prompt"Javacis not an internal command or external command, or a program or batch file that can be run"but the inputjava-versioncan display normallyJDKversion number, descriptionJavacommand is available.

input Set View environment variables and discover Java_home The configuration is OK, but the call to %java_home% , the variable is not replaced by the actual path, and the reason is unknown.

Solution:
Run -->cmd
Run the following command in the console to set the Java environment variable to resolve:
Set Path=xxx;%java_home%\bin;

XXX for the system in the original value of path, note to write back.

PostScript: One possible cause of this problem is thatcmd is always on, modifying environment variables without closing and then opening CMD, resulting in no effect. Because the configuration toss a long time, no longer inspection .

If you have encountered this situation when installing the JDK, you can use this method I proposed to try, in the Java configuration environment to be particularly careful with those characters, not because the input format is not correct, waste a lot of time, and it is difficult to find.

How to troubleshoot a problem where the Java environment variable settings do not work

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.