JDK download and installation

First download the latest version of jdk. You can go to  http://java.sun.com/j2se/1.4.2/download.html

Version 1: Suitable for win7+oracle version java

Download the latest jdk version and
open the interface. Select Download J2SE SDK under the J2SE v 1.4.2_08 SDK tab,
then select Accept License Agreement to agree, and then see the three lines of black text below,
(jdk installation and download under different systems), so select "Windows Platform - Java (TM) 2 SDK,
Standard Edition 1.4.2_08” jdk download below.
    After everything is downloaded. Then choose the installation path. Install it on your computer. Come down and do some settings.
    First, right-click on My Computer. Open properties. Then select "Environment Variables" in "Advanced".
    The system variables in the new opening interface need to set three attributes: "java_home", "path", and "classpath",
    among which in an environment where jdk has not been installed. The path attribute is inherently present. And java_home and classpath do not exist.
    First click "New", then write java_home in the variable name. As the name implies, the meaning of this variable is the installation path of java, haha, then write the path
    just installed "C:\jdk1.4" in the variable value.
    Secondly Find the path in the system variable, and then click Edit. The meaning of the path variable is that the system can recognize the java command in any path,
    then the variable value is "% java_home%\bin;% java_home%\jre\bin", (where " %java_home%” means just now
    Set the value of java_home), you can also directly write "C:\jdk1.4\bin"
    and finally click "New", and then write classpath on the variable name. The meaning of this variable is to load the class (class or lib) for java. Path,
    only if the class is in the classpath, the java command can recognize it. Its value is ".;% java_home%\lib;% java_home%\lib\tools.jar
    (to be added. represents the current path)", which is the same as "% java_home% has the same meaning". After the
    above three variables are set, press "OK" until the properties window disappears, then verify to see if the installation is successful.
    First open "Start" -> "Run" and type "cmd" to enter the dos system interface. Then hit "java -version" if the installation is successful.
    The system will display java version jdk "1.4.08"... (different version numbers will be displayed differently).

    After successful installation, you can write your own java program

Version 2: openjdk +win10

First download the zip jdk from the openjdk official website and unzip it to a custom directory. My directory is as follows:

Click on this computer, go to "Environment Variables", add the "java_home" option , the variable is your jdk path, as shown below:

Add "jre_home" . The specific method is the same as "java_home". My jre_home path is "D:\Program Files\Java\openjdk-11+28_windows-x64_bin\jdk-11\jre". Note that jre is generated manually, because in jre has been removed in openjdk11. To manually generate jre, you can refer to: Openjdk does not come with jre - Battle Fortress - OSCHINA - Chinese open source technology exchange community

 

Secondly, find the path in the system variable, and then click Edit. The meaning of the path variable is that the system can recognize the java command under any path,
    then the variable value is ";% java_home%\bin;% jre_home%\bin", (where " %java_home%" means the value of java_home just set) and move the variable value up. (Currently relative paths are invalid in Windows 11 and java -version cannot find the java version. It is recommended to use method 2)

Method 2: Click the browse button directly, find the directories of java_home and jre_home, and process them with absolute paths. As shown below:

 Add the classpath variable , my variable is ".;% java_home%\lib;% jre_home%\lib".

Save the above data and enter "java -version" in cmd to display as follows:

Guess you like

Origin blog.csdn.net/weiweiqiao/article/details/130975539