Scenario: Is it difficult to do things in the world? For this, it is easy for those who are difficult to do so, and those who are not are also difficult. Is it difficult for people to learn? It is easy to learn, but it is also difficult to learn.
1 Preparation 1.1 Check the system version
Recommendation: Install with the root user when installing the software.
Because the Java JDK distinguishes between 32-bit and 64-bit systems, it is important to determine how many of our CentOS systems are installed before installing the following commands:
Uname-a
Explanation: If there is a x86_64 is 64 bit, not is 32 bit. The following is X686 or x86_64 the kernel is 64 bits, i686 or i386 the kernel is 32 bits so I can judge my CentOS 64-bit system, so I need to download 64-bit system JDK. 1.2 Download JDK Here I use the 1.7 version of the JDK, and did not choose the new version 1.8, because I think this version of the JDK is relatively stable. Click Http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html to go to the JDK download page
The Java archive at the bottom is saved in the history archive of Java, click to enter
Here we find the 1.7 version to download and continue to click
The following two are all 64-bit JDK, the difference between the two is the installation method is different. Reference http://www.cnblogs.com/lixuwu/p/6097102.html
Here i download all two software to practice
1.3 JDK Installation Environment
The required software and system are as follows: Virtual machine (Vmware), the CentOS system installed in the virtual machine, xshell,filezila,jdk-7u80-linux-x64.tar.gz
2 Installing the JDK
With the above preparation, we now have an environment where we can install the JDK.
2.1 Create a user directory and then use the command in Xshell to jump to the user-specified folder (typically each project has its own JDK configuration in the project): Project
When using a non-root user login, follow these steps:
#首先切换到root权限su # Create directory mkdir PROJECTLLCD project/
2.2 Uploading JDK files to the specified directory
Then use Filezila to copy the JDK to the project folder below:
is the extracted directory list, the uploaded file is already labeled.
2.3 Unpacking the JDK
Extract files directly from the directory where the JDK files are located
Tar-zxv-f jdk-7u80-linux-x64.tar.gz
To view the contents of a JDK file:
With the above steps, our JDK has all been installed and the next step is a more important one: Configure environment variables
2.4 Configuring environment variables
1. Execute first
Vim/etc/profile
In the directory where the JDK is located, look for the root directory of the JDK
Pwd
The absolute path to the JDK is used in the configuration file.
2. After opening the key plate (i) into the editing mode, copy the following content to the bottom
java_home=/home/cs408/project/jdk1.7. 0_80 PATH= $JAVA _home/bin: $PATH CLASSPATH= $JAVA _ Home/jre/lib/ext: $JAVA _home/lib/tools.jar export PATH java_home CLASSPATH
Note: Based on the configuration information above, we have already completed the configuration of the environment variable. It is important to note that the path in the configuration of the oh, we must put Ava_home/bin in front,otherwise, using Java command, the
system will find the previous Java, do not look down, so that the Java executable file run directory is not $java_home/bin, and in other directories, it can cause a lot of problems. 4, after writing, we press the keyboard (ESC) button to exit, and then press (: WQ) to save and turn off vim. 5, after the configuration is complete, the most important step is to make the file effective immediately
Source/etc/profile
3 Verifying success
Java-versionecho $JAVA _home
4 Uninstalling the JDK first execute the command to view the version of the JDK under the server:
Then execute the command to delete each version of the query above.
Yum-y Remove Java java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
5 Supplemental openjdk and JDK differences between links
The historical reason is that OPENJDK is the open source version of the JDK, released in the form of the GPL (general public License) protocol (open, which is referred to by the main topic). In the JDK7, OPENJDK has been developed as the backbone of JDK7, SUN JDK7 was published on the basis of OpenJDK7, most of the original code is the same, only a small part of the original code is replaced. Published using JRL (javaresearch License,java Research License Agreement). As for OpenJDK6, there is a complex aspect, first of all, OpenJDK6 is a branch of JDK7, and as far as possible to remove the new features of Java SE7, so as to conform to JAVA6 standards. The differences between JDK and OPENJDK can be summed up in the following points:
different licensing agreements: The OPENJDK is released using the GPL V2 protocol, while the Sun JDK is released using JRL. While both protocols are open source, the difference in use is that the GPL V2 allows for commercial use, while JRL only allows for personal research to be used.
OPENJDK does not contain deployment (deployment) features: The features that are deployed include: Browser Plugin, Java Web Start, and the Java Control Panel, which are not found in openjdk.
OPENJDK Source code is not complete: This is very easy to think, in the GPL-OPENJDK, part of the SUN JDK source code because the issue of property rights can not be opened to OPENJDK use, The most important part of this is the code of the optional component SNMP part in JMX. So these open source code makes it plug for OpenJDK compile time, and you can choose not to use plug. IcedTea, however, developed the same functional source code (OPENJDK6) for these incomplete parts, prompting OpenJDK to be more complete.
part of the source code is replaced with open source code: Due to the problem of property rights, many property rights are not Sun's source code is replaced by some of the same functions of open source, such as the font rasterization engine, using the free type instead.
The OPENIDK contains only the most streamlined JDK: OPENJDK does not contain other software packages, such as Rhino Java DB JAXP ..., and the packages that can be separated are also separated as much as possible, but most of them are free software that you can download yourself to join.
Cannot use the Java trademark: This is easy to understand, in the installation of OPENJDK machine, the input "java-version" display is OPENJDK, but if you are using IcedTea patch OpenJDK, the display is java.
In short, in the Java system, there are still a lot of non-free ingredients, the development of the source code is not thorough enough, I hope that Oracle can make JCP more open, which is what all the Java community wants.
Linux (Centos) installation Java JDK and considerations