Linux under source installation JDK

Source: Internet
Author: User

One, find. tar.gz Source Package

Will Jdk1. XXXXXXX.tar.gz source package is placed in the location you want to, for example, I put on the U disk

1, Mkdir/mnt/udisk #创建挂载点:

2, Mount/dev/sdb1/mnt/udisk #将u盘挂载到/mnt/udisk

3, Tar Zxvf/mnt/udisk/xxxx/jdk1. Xxxxxxx.tar.gz/usr/local/java #将压缩文件解压到/usr/local/java

4, mv/usr/local/java/jdk1.7xxxxxx/usr/local/java/jdk1.7 #将解压后的文件的名字改短一点, convenient to set the environment variables (this step can also not change the text Name)

Second, set environment variables

1, vim/etc/profile #设置配置文件

Export java_home=/usr/local/java/jdk1.7

Export Classpath=.:%java_home%/lib/dt.jar:%java_home%/lib/tools.jar

Export path= $PATH: $JAVA _home/bin

2, Source/etc/profile #申明环境变量

Third, the test is successful

VI Test.java

public class test{

public static void Main (string[] args) {

System.out.println ("Hello World");

}

}

Javac Test.java

Java Test

Hello World

okkkkk!

Linux under source 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.