Linux installation JDK

Source: Internet
Author: User

Version 1.6

http://download.csdn.net/download/javahr/7291125

First, installation

Jdk-6u45-linux-x64.bin files are self-extracting files that are installed on Linux as follows,

1. Assigning Permissions

chmod 755 Jdk-6u45-linux-x64.bin First (4 readable +2 writable +1 executable =) 7 is the owner's permission, the second 5 represents the permissions of the group member, and the third 5 represents the permissions of the other groups.

2. Create the installation directory, set the installation path under/APP/JAVA/JDK, and copy the file to the path:

Return to root directory CD/Enter/APPCD app to create/app/javamkdir Java into/APP/JAVACD./java Create jdk directory mkdir jdk into/APP/JAVA/JDKCD./jdk

3. Use the MV command to cut the file.
If you need to cut the jdk-7u79-linux-x64.tar.gz file in the/tmp directory into the/USR/JAVA/JDK directory, execute the following command:

Mv/tmp/jdk-6u45-linux-x64.bin  /USR/JAVA/JDK

4. Unzip

./jdk-6u11-linux-i586.bin (Note that this step must be in the directory where Jdk-6u11-linux-i586.bin is located)

Second, the configuration

1. Open/ETC/PROFILE.D File

Vi/etc/profile

  

2. Configure Environment variables

Export Java_home=/app/java/jdk/jdk1.6.0_45export java_bin=/app/java/jdk/jdk1.6.0_45/binexport PATH= $PATH: $JAVA _ Home/binexport classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jarexport java_home java_bin PATH CLASSPATH

3, let/etc/profile file changes immediately after the effective, you can use the following command:

. /etc/profile Note:. and/etc/profile have spaces.

be sure to log off (or restart your computer) before testing for configuration success

4, testing,

1), check the Java version

Java-version

Output

Java version "jdk1.6.0_02" Java (tm) 2 Runtime environment, Standard Edition (build jdk1.6.0_02) Java HotSpot (tm) Client VM (Build jdk1.6.0_02, Mixed mode)

2), write a Java class test

Create a Hello.java file

VI Hello.java

Writing Java Classes

public class Hello {public static void main (String args []) {System.out.println ("Hello world!");}}

Compile

Javac Hello.java

Run

Java Hello

Output

Hello world!

If the operation succeeds, prove that you have successfully installed!

   Thanks: Thank you for your patience and reading!

Linux installation JDK

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.