preface
Because work needs, try to learn and use Java, this article mainly records the Java development environment related configuration
Java
Java Runtime Environment
introduce
The Java Runtime Environment (JRE) is a collection of environments necessary to run Java programs, including the JVM standard implementation and Java core class libraries. JRE is a Java runtime environment and is not a development environment, so it does not include any development tools (such as compilers and debuggers)
JRE is designed for the Java program running environment. In the development environment, you only need to install JDK, which contains JRE
Download, install, use
Visit the Official Java website to download, install, and use the Java software.
Official website: www.java.com
Java Development Kit
introduce
Java Development Kit (JDK) is a Java software Development Kit for Java developers, including the JRE, a bunch of Java tools (Javac/Java/JDB…). And java-based class libraries (that is, Java apis including Rt.jar). For a Java programmer, the use of the JDK is a basic skill.
download
Go to the JDK product download page on the Oracle website and find the specific JDK version to download.
Because Java is cross-platform, you need to pay attention to the CPU platform as well as the operating system platform. In addition, to download JDK8 from Oracle, you also need to log in to Oracle account, and the registration process is very tedious, so I accidentally found a magical website bugmenot.com
Download page: www.oracle.com/java/techno…
The installation
JDK 8U251-macosx-x64. DMG file is downloaded from Oracle’s official website. If you mount JDK 8U251-Macosx-x64. DMG file, you will get JDK8 Update 251. PKG file.
You can then check the currently installed Java version by using Java –version
configuration
TODO
check
TODO
uninstall
Uninstall Java completely on MacOS and run the following commands one at a time
Delete related system components
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefpane
# find the current version
ls /Library/Java/JavaVirtualMachines/
# Delete related versionsSudo rm - rf/Library/Java/JavaVirtualMachines/JDK - 9.0.1. JDKCopy the code
Maven
introduce
Maven is a dedicated tool for building and managing Java-related projects
download
Download the Archive from the Download page of the Maven project official website
Download address: maven.apache.org/download.cg…
The installation
For example, to install Maven 3.6.3 on MacOS, download the apache-Maven-3.6.3-bin. zip file, decompress it and move the binary file to a specific directory
/apache-maven-3.6.3-bin.zip mv./apache-maven-3.6.3 ~/JavaLibrary/Copy the code
Then add the following configuration to ~/.bash_profile to add Maven’s executables to the PATH environment variable
The export PATH = $PATH: ~ / JavaLibrary/apache maven - 3.6.3 / binCopy the code
Then run source ~/.bash_profile for this to take effect
Then you can run mvN-v to check whether the configuration takes effect
Optional configuration
Add a domestic mirror mirror warehouse
Setting up a Maven project requires going to the repository to download some dependencies. The default central repository of Maven is the UK, so the download may fail or be very slow due to inconvenient access to the external network in China, so we changed the central repository to the domestic one.
Open ~/JavaLibrary/apache-maven-3.6.3/conf/settings. XML, find the mirrors node, and add the following content to it
<mirror>
<id>maven.net.cn</id>
<mirrorOf>central</mirrorOf>
<name>mirror in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
</mirror>
Copy the code
use
TODO
Spring
download
TODO