MAC installation JDK (with JDK download address)

1. JDK acquisition

1. You can go directly to oracle official website to get JDK: Java Downloads | Oracle

Note: Because downloading the installation package from oracle now requires registration of an oracle account, and the download speed is limited. So I share with you where I got the resources

2. Follow the official account "Paddy Field Shell Resources"  and reply  "JDK" to get the JDK installation package ( true sharing, cheating people will not get an offer this year )

3. At the same time, there are various commonly used development tools and teaching videos in the supporting applet. If you don’t need it, you can save it first. Next time you need to use it, you can just find it directly, so as to avoid being unable to find it on the Internet when you need it . The resources are as shown in the figure below

2. Installation Tutorial

1. Double-click to run the downloaded JDK installation file.

2. After the following interface pops up, double-click the file ending with .pkg to enter the installation guide interface

3. After the installation guide interface pops up, keep clicking to continue installing JDK.

4. Installing...

5. After the following interface pops up, the installation is successful

6. Open the command line interface on your computer

7. Enter the command java -version to check whether the JDK is installed successfully. If the version number appears, the installation is successful (see the figure below)

java -version  //查看JDK版本

Tip: Some students may have doubts. I am not very clear about how it can run without environment variables like Windows. . .

The author is not very clear about other versions of the computer, but mine does not need to be configured (the author's computer is the 20th version of the MacBook Pro)


If you need to configure environment variables, please continue reading

8. Enter the command "/usr/libexec/java_home -V" on the command line page to view the JDK installation directory (copy the directory, it will be useful later)

/usr/libexec/java_home -V

9. Enter the command sudo vi ~/.bash_profile

10. Enter the following command in the opened file, JAVA_HOME refers to the installation directory of your JDK, which is the content copied in step 8

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_321.jdk/Contents/Home"

hint:

  1. Press the "i key" in the input method English mode to enter the edit mode

  2. After writing, press "esc key" and input ":wq" to save and exit
 

11. Enter " source .bash_profile " on the command line to make the configuration just written take effect, and then verify again whether the JDK is installed successfully.

At this point, this article is over. If this article and this chapter solve your problem, please give the author a triple link (* ̄︶ ̄)

Guess you like

Origin blog.csdn.net/qq_42825813/article/details/123046604