Preface
First of all, you need to install JDK. After the JDK is installed, you also need to configure the three environment variables "JAVA_HOME", "path", and "classpath" on your computer to build the Java development environment. In an environment where jdk has not been installed, the path environment variable is a system variable that originally exists, while JAVA_HOME and classpath do not exist.
1. Configure the environment variables of JAVA_HOME [recommended method, do not use absolute paths]
Operation steps (win7 system): Computer → Right-click "Properties" → Advanced System Settings → Advanced → Environment Variables, as shown in the figure below:
Because I have configured it before, you need to click New to reconfigure!
Description: JAVA_HOME -->> Must be in full capital
E:/java-tools/Java/JDK8_64/jdk1.8.0_77/ -->> The location where you installed JDK before, but it is recommended to have an additional slash at the back
2. Configure path environment variables
My variables are all configured on local variables. I usually don’t move system variables, which is my personal suggestion! There may be something wrong, so please forgive me! path -->> This is case-insensitive
%JAVA_HOME%bin
--->>> %The variable name you just defined is %bin folder. If you did not configure the slash in the previous step, then you need to write %JAVA_HOME%/bin like this
3. Configure classpath environment variables
The purpose of setting classpath is to tell the Java execution environment where you can find the Java program (.class file) you want to execute. Regarding this ClassPath variable, you don't need to configure it. You often see it online.
The copy code code is as follows: classpath The copy code code is as follows:.;%JAVA_HOME%lib/dt.jar;%JAVA_HOME%lib/toos.jar;%JAVA_HOME%jre/lib/rt.jar;
But after learning Java for so long, it has been found that not configuring ClassPath does not affect the development and operation of Java projects.
4. Test whether
Click --> to start and run the cmd command
Then follow the following command to check whether your jak is installed:
After the above steps, you will be able to install your jdk successfully! If there is any failure, please check your operation steps!
Thank you for your reading, I hope you can configure your Java environment variables smoothly.