Linux Centos6.0 Online Installation build JDK environment

Source: Internet
Author: User

Preparatory work:

Uninstall the system default old JDK, execute the following command

Rpm-qa|grep GCJ Use the above command if you see the following information: java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 use the RPM-E--nodeps command to see the information above, as shown below. RPM-E--nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

1. Download the JDK:

wget--no-check-certificate--no-cookies--header "Cookie:oraclelicense=accept-securebackup-cookie"/HTTP/ download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.rpm

Note: The default download to the current directory

2, if it is a non-root user, modify the executable permissions of the current RPM file to the specified user group

chmod g+x jdk-7u71-linux-x64.rpm

3, start installing jdk1.7 in Linux, execute the following command and determine.

RPM-IVH jdk-7u71-linux-x64.rpm

The 4,linux system adds system environment variables. Execute the "vi/etc/profile" command, add the following code at the bottom of the file, and save it.

 
 
   
  
  1. Export java_home=/usr/java/jdk1.7.0_71 # # #JAVA_HOME指明JDK安装路径, the specific value of how much, to/usr/java under view

  2. Export CLASSPATH=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

  3. Export PATH= $PATH: $JAVA _home/bin


5, execute the "source/etc/profile" command to make the system variable you just added take effect.

6, add two soft connections, execute the following command.

 
 
   
  
  1. Ln-s-f/usr/java//usr/java/jdk1.7.0_71/jre/bin


7, execute the "java-version" command to view the JDK version and detect if the installation was successful.


8, check whether Java files can be compiled properly, executable "VI pc811.java", add the following code and save.

public class pc811 {public static void main (string[] args) {System.out.println ("pc811.com");}}

Step 9 : Execute "java Pc811.java" and execute "Java pc811" again if the output "pc811.com" means that the jdk1.7 has been successfully installed on the Linux system, and that Java and related programs can be compiled and run properly.


Linux Centos6.0 Online Installation build JDK environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.