Background: I find it troublesome to frequently change the computer to install the environment, etc. The main thing is to record it, so as not to dig around every time I install it. .
1. Download and install JDK
Go to the official website to download the required JDK: https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
What is downloaded here is JDK11. Please pay attention to downloading the corresponding installable dmg according to different chips; it does not matter if you download the wrong one, you will be prompted to download and install it again during installation.
After downloading, click and follow the prompts to install. The default installation path is: /Library/Java/JavaVirtualMachines
2. Configure environment variables
1. Open the terminal and enter. You need to use sudo and have administrator rights, otherwise the saved file cannot be modified.
sudo vim /etc/profile
2. Enter the following configuration information. You must configure it according to the version number you installed. You can check it yourself under the installation path /Library/Java/JavaVirtualMachines):
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home"
export JAVA_HOME
CLASS_PATH="$JAVA_HOME/lib"
PATH=".$PATH:$JAVA_HOME/bin"
Simple operation of vim:
press the keyboard i
, display INSERT, enter editing mode
esc
and exit editing mode
, enter :wq!
to save and exit
3. Make environment variables effective
terminal input
source /etc/profile
6. Check whether the environment variable configuration is successful.
Enter the following command on the terminal. If you can get the JAVA_HOME path, the JAVA environment variable configuration is completed.
echo $JAVA_HOME
7. Check the environment.
Check the Java environment: enter the following brightly on the terminal and display the version number.
java -version
Check JDK
javac -version
3. Plug-in recommendation
Rainbow Brackets
are really needed when the code is long.
Lombok
simplifies the writing of code in the Model layer. In the past, pojo classes/entity classes needed to provide set, get, toString, equals, and hashCode themselves. Lombok simplified the above operations through various annotations.
- @Data: set, get, toString, equals, hashCode will be automatically generated
- @NoArgsConstructor: Automatically generate no-argument constructor
- @AllArgsConstructor: Automatically generate full parameter constructor
- @Accessors(chain = true): Enable chain programming
GenerateAllSetter
automatically generates all get and set methods of the object. new an object and then use the Alt key + Enter key to bring up the options. Just select the options according to your needs.
Translation
translation, right-click to translate into Chinese; you can also convert Chinese into English.
other:
Reference:
https://blog.csdn.net/godot06/article/details/104378253
https://blog.csdn.net/Very666/article/details/106915540
https://blog.csdn.net/weixin_48088839/article/ details/124387437