Home  >  Article  >  Java  >  How to check whether java is installed

How to check whether java is installed

angryTom
angryTomOriginal
2020-02-03 10:51:184505browse

How to check whether java is installed

How to check whether java is installed

Enter the following command at the command line: java -version If it prints The result shows that jdk is installed. Then enter javac If prompted, 'javac' is not an internal or external command, nor is it an operable program or batch file. Then you need to configure environment variables.

Recommended related article tutorials: Java introductory tutorial

Steps to configure environment variables:

Step 1:

Right-click "My Computer"->Properties

Select the "Advanced System Settings" option in the left navigation,

Select the " "Environment Variables" option

Step 2:

Configure the following under "System Variables":

(1)New->Variable Name : JAVA_HOME variable value: D:\Java\jdk1.6.0_12 (This is just my JDK installation path)

(2) Edit -> Variable name: Path Add: % at the front of the variable value JAVA_HOME%\bin;%JAVA_HOME%\jre\bin

(3) New->Variable name: classpath Variable value: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar; %JAVA_HOME%\lib\tools.jar

Note: It is generally not necessary to set the value of the environment variable classpath when installing jdk. If this is the first time that jdk is installed on the computer and the classpath has not been set before, there is no need to set the classpath. However, if the computer has previously installed some commercial Java development products or some products with Java technology, and the classpath value has been set, then when running Java, loading the old version of the class library provided by these old products may cause problems. The loaded class cannot be found, causing a runtime error in the program.

(4)Edit->Variable name: JAVA_HOME, variable value: D:\Java\jdk1.6.0_10

Note: When setting When the variable is at the end, do not add ";"

The above is the detailed content of How to check whether java is installed. 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