CentOS installation and configuration JDK1.6 tutorial

Source: Internet
Author: User
Installation and configuration in LINUX is the only way for beginners of Java to start Java programming. therefore, how to install and configure JDK in LINUX becomes the primary issue, this article will introduce you to the installation and configuration of JDK in LINUX. How does jdk 1.6 be installed in LINUX? let's start our demonstration: jdk installation and configuration under Centos6.0 1. jdk 1.6 installation preparation from oracle website w

Installation and configuration in LINUX is the only way for beginners of Java to start Java programming. therefore, how to install and configure JDK in LINUX becomes the primary issue, this article will introduce you to the installation and configuration of JDK in LINUX.

How is JDK1.6 installed in LINUX? let's start our demonstration:

Install and configure jdk in Centos6.0

1. JDK1.6 installation preparation

Download the linux jdk from the oracle website www.oracle.com. the version I downloaded isJava SE Development Kit 6 Update 38,

AddressHttp://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.htmlOpen the terminal and use the wget command to download the software package. we recommend that you download the package in windows before uploading it to linux. you can also open the above link in the browser on the linux graphic interface, because the oracle website requires a protocol for downloading files, you must agree to the protocol before downloading the files. Here, I downloaded it to the root directory and added executable permissions.

Execution permission

[root@linux ~]# chmod +x jdk-6u38-linux-i586.bin

Run the Installation Command

[root@linux ~]# ./jdk-6u38-linux-i586.bin

After successful installation, the jdk1.6.0 _ 38 directory is generated under the/root directory, and then copied to/usr/local.

[root@linux ~]#cp jdk1.6.0_38  /usr/local/jdk1.6.0_38

2. configuration after JDK1.6 installation

After successful installation, you need to configure jdk environment variables

[Root @ linux ~] # Vim/etc/profile: execute the edit profile File command

Add the following content before umas k022:

export JAVA_HOME=/usr/local/jdk1.6.0_38export JAVA_BIN=/usr/local/jdk1.6.0_38/binexport PATH=$PATH:$JAVA_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOME JAVA_BIN PATH CLASSPATH

To make the/etc/profile file take effect immediately after modification, run the following command:

[root@linux ~]# . /etc/profile

Note: there are spaces between. and/etc/profile.

Open the terminal and enter java-version. If java version information is displayed, the installation is successful.

3. Tests after JDK1.6 is installed and configured

Create Test. java

[root@linux ~]# vim Test.java

Add the following content

public class Test{public static void main(String[] args){System.out.println("Hello,Welcome to Linux World!");}}

Run the cd command on the terminal to enter the Test. java directory, and then enter

[root@linux ~]# javac Test.java[root@linux ~]# java Test

If the output

Hello,Welcome to Linux World!

The configuration is successful!

If compilation fails, restart the system.

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.