Download the java package: https://www.oracle.com/java/technologies/downloads (Version 8 is stable)
Directly install java programs without thinking (including jdk-development and jre-running)
Next is the java environment configuration:
Create system variables (user variables also work)
1. Variable name: JAVA_HOME
Value: jdk address (such as C:\ProgramFiles\Java\jdk1.8.0)
2. Variable name: CLASSPATH (optional, the environment is for some server applications and does not affect the use of java)
Value: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; (fixed content)
Add to the Path variable:
- %JAVA_HOME%\bin ( jdk的)
- %JAVA_HOME%\jre\bin (jre, make sure javaide runs without errors)
- C:\ProgramFiles\Java\jdk1.8.0\bin --- The bin path of jdk, it can be placed at the front of the path during runtime, and it is used first (optional)
Final test: no error is the configuration is successful
- javac
- java
- java -version
If you want to configure different java environments:
- Rename java numbers.exe javac numbers.exe in java/bin path
- Create a system variable: name java-home number value: jdk path
Add to path:
- %JAVA_HOME number%\bin
- %JAVA_HOME number%\jre\bin
- C:\ProgramFiles\Java\jdk1.8.0\bin (bin path of jdk, optional)
Use a different environment:
- Run java environment 1: java -jar package.jar
- Run java environment 2: java number-jar package.jar