Home >Java >JavaBase >Java command is not an internal command nor an external command solution

Java command is not an internal command nor an external command solution

尚
Original
2019-11-21 09:27:174913browse

Java command is not an internal command nor an external command solution

Sometimes after we install jdk and run the java command in cmd, the message "javac is not an internal command or an external command, nor is it an operable program or batch file" appears. This is Because the environment variables are not configured or the environment variables are configured incorrectly.

Let’s take a look at how to configure java environment variables:

1. How to enter the environment variable settings. This is only for Windows 7. For other information, please search online: " Right-click "Computer" - "Properties" - "Advanced System Settings" - "Advanced" - "Environment Variables" to open the environment variable setting window.

2. In the "System Environment Variables" setting window below, click "New" to create the JAVA_HOME variable:

Variable name: JAVA_HOME

Variable value: C: \Program Files\Java\jdk1.6.0_26

3. In the "System Environment Variables" setting window below, click "New" to create a CLASSPATH variable:

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 the semicolon )

4. In the "System Environment Variables" setting window below, double-click the "PATH" variable and add after the variable value: ;C:\Program Files\Java\jdk1.6.0_26\bin; ( Note the semicolon)

For more java knowledge, please pay attention to java basic tutorial.

The above is the detailed content of Java command is not an internal command nor an external command solution. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn