JAVA environment configuration & multiple environments (full, detailed, simple)

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:

  1. %JAVA_HOME%\bin   ( jdk的)
  2. %JAVA_HOME%\jre\bin (jre, make sure javaide runs without errors)
  3. 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

  1. javac
  2. java
  3. java -version

If you want to configure different java environments:

  1. Rename java numbers.exe javac numbers.exe in java/bin path
  2. Create a system variable: name java-home number value: jdk path

Add to path:

  1. %JAVA_HOME number%\bin  
  2. %JAVA_HOME number%\jre\bin
  3. C:\ProgramFiles\Java\jdk1.8.0\bin (bin path of jdk, optional)

Use a different environment:

  1. Run java environment 1: java -jar package.jar
  2. Run java environment 2: java number-jar package.jar

Guess you like

Origin blog.csdn.net/qq_63283137/article/details/129375841