Linux-JDK installation instructions


 1.       JDK installation steps in Linux environment

1.1   Upload jdk-7u75-linux-x64.tar.gz and extract it

1. Upload the downloaded jdk-7u75-linux-x64.tar.gz file to the Linux server , or download it online by wget .

Download address: http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk7-downloads-1880260.html (The version of jdk1.7 is provided here)

2. Press jdk- 7u75 -linux-x64.tar.gz .

           The decompression command is : tar –zxvf jdk-7u75-linux-x64.tar.gz

           The decompressed file directory structure is:


 

1.2  Set PATH

1. Create the java directory in the /usr/local/ directory . The command is mkdir /usr/local/java

2. Move the decompressed java/jdk1.7.0_75 directory including all files in the directory to /usr/local/java/

    The copy command is : mv ../jdk1.7.0_75 /usr/local/java/

3. Modify the profile   to set the PATH

    Execute the command : vi /etc/profile

                 Append the following to the end of the file:

export JAVA_HOME=/usr/local/java/jdk1.7.0_75  
export JRE_HOME=/usr/local/java/jdk1.7.0_75/jre  
export PATH=$PATH:/usr/local/java/jdk1.7.0_75/bin  
export CLASSPATH=./:/usr/local/java/jdk1.7.0_75/lib:/usr/local/java/jdk1.7.0_75/jre/lib

    Enter : wq to exit and save, then restart the Linux system.

 

1.3  Verify the installation result

After restarting the system, enter: java -version , if you see the screenshot below, your jdk has been installed successfully.

 

 

2. Possible problems

2.1   Before installation, first uninstall the JDK installed by Centos

[root@localhost soft]# java -version
java version “1.4.2″
thou (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42)
Note that according to my installation under 5.2, it seems that the installation of jdk6 cannot take effect without uninstalling the 1.4 that comes with it. In order to avoid this situation, we first uninstall the 1.4 version of the jdk that comes with it.
[root@localhost soft]# rpm -qa | grep jdk
[root@localhost soft]# rpm -qa | grep gcj
libgcj-4.1.2-42.el5
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
First confirm the specific version number of jdk above, and then
[root@localhost jdk1.6.0_11]# yum -y remove java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Setting up Remove Process
Resolving Dependencies…………..(Start uninstalling)
Removed: java-1.4.2-gcj-compat.i386 0:1.4.2.0-40jpp.115
Dependency Removed: antlr.i386 0:2.7.6-4jpp.2 bsf.i386 0:2.3.0-11jpp.1 bsh.i386 0:1.3.0-9jpp.1 gjdoc.i386 0:0.7.7-12.el5 hsqldb.i386 1:1.8.0.9-1jpp.2 openoffice.org-calc.i386
1:2.3.0-6.5.el5 openoffice.org-core.i386 1:2.3.0-6.5.el5 openoffice.org-draw.i386 1:2.3.0-6.5.el5 openoffice.org-graphicfilter.i386 1:2.3.0-6.5.el5 openoffice.org-impress.i386
1:2.3.0-6.5.el5 openoffice.org-langpack-zh_CN.i386 1:2.3.0-6.5.el5 openoffice.org-langpack-zh_TW.i386 1:2.3.0-6.5.el5 openoffice.org-math.i386 1:2.3.0-6.5.el5 openoffice.org-
writer.i386 1:2.3.0-6.5.el5 openoffice.org-xsltfilter.i386 1:2.3.0-6.5.el5 tomcat5-jsp-2.0-api.i386 0:5.5.23-0jpp.7.el5 tomcat5-servlet-2.4-api.i386 0:5.5.23-0jpp.7.el5 xalan-
j2.i386 0:2.7.0-6jpp.1 xerces-j2.i386 0:2.7.1-7jpp.2 xml-commons-apis.i386 0:1.3.02-0.b2.7jpp.10 xml-commons-resolver.i386 0:1.1-1jpp.12
Complete! (Uninstallation completed)

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327043792&siteId=291194637