Official website address: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Select the corresponding version, click jdk, enter the download page, and select the "Linux x64" version of the Linx compressed package with the suffix "xxx.tar.gz".
Find the compressed package in the download, double-click the file, drag the file in the directory to the "/home/stone/java/" directory (equivalent to manual decompression), the "/home/stone/java/" file is my own computer The user can store according to his own directory structure, as shown in the figure below:
Don't ask how my Ubuntu is so similar to a Mac system, I won't tell you, I installed a Mac theme.
Open the command line tool and enter the command:
$sudo gedit ~/.bashrc
This command is to modify the global variable file, and paste the following code at the end of the file:
export JAVA_HOME=/home/stone/java/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
**Note: ** Among them, "home/stone/java/jdk1.8.0_181" is my own JDK directory, and users need to change to their own storage directory.
The configuration is as follows:
After copying the code, save and leave.
input the command:
sudo source ~/.bashrc
Make the global file take effect. At this point, even if the Java environment is installed successfully, then we enter the command:
java -version
Check the Java version to confirm whether the Java installation is normal, as shown below:
If the above Java version information appears, the installation is successful.
Need to create a Java project, first of all we have to go to the official website and now IDEA development tools, address: https://www.jetbrains.com/idea/download/#section=linux
The download and installation process is relatively simple, we will not do too much introduction here, the installation only needs to enter the IDEA bin directory and execute the command line command:
. /idea.sh
The installation is complete.
It only takes 3 steps to crack IDEA. Of course, if you have the ability, it is recommended that you buy the genuine one.
Click File => New => Project..=> Click the "Maven" option on the left, as shown below:
Click Next.
Then keep clicking "Next" to complete the creation of the project.
In src/main/java, add the package name "com.hello.java", add the Application.java class, add the main method, output "Hello, Pharaoh", click the debug button to run the project, as shown in the figure above, run successfully, output Print the information, and the entire project is now created.
The main part of the Maven project is shown in the following figure:
The important part is the red part of the chart above, where:
As the core function of Maven, it is convenient to reference the jar package, so that we don’t have to find the jar package online, just need to automatically download the jar package after the project root directory pom.xml is configured. The example configuration is as follows:
< dependency><groupId>ch.qos.logback</groupId><artifactId>logback-classic</artifactId><version>1.1.1</version></dependency>
To find the Jar package that the Maven project depends on, visit: http://mvnrepository.com/ Enter the name to easily find and copy the code.
Recommended Posts