Java environment configuration in linux and linuxjava Environment

Source: Internet
Author: User

Java environment configuration in linux and linuxjava Environment

I plan to learn the Java language recently.

For beginners like me, I first wanted to experience the Java language and how to implement it...

However, o_O indicates that it is very confusing. It is also the most important thing in practice. After you configure the environment, you can start to learn more.

  

1. First, go to the official website:

Bytes

I downloaded a 64-bit jdk-6u13-linux-i586.bin.

2. Install jdk and open the terminal:

(1) Use root permissions, first is to change the executable permissions of the jdk-6u13-linux-i586

Using the ll command, you can see:

The executable permission of the jdk-6u13-linux-i586 is changed to: (about the user permission, I am Baidu directly, a lot of information)

(2) Next, execute jdk-6u13-linux-i586

Will generate: jdk1.6.0 _ 45

(3) then, move the generated jdk1.6.0 _ 45 to the/opt directory.

3. Configure Environment Variables

Use vi/vim to open/etc/profile to add Environment Variables

Add: (JAVA_HOME is the installation directory of JDK 1.6.0 _ 45)

P.S ).

Problem: My JAVA_HOME path has been successfully added and cannot be found when some class files are used. That is to say, the file I added cannot be found on CLASSPATH.

So I used echo $ CLASSPATH to view the class file I added to CLASSPATH. No, I thought it was an error. I have carefully modified/etc/profile several times, still does not work.

Solution: Later I changed the CLASSPATH method. I directly entered export CLASSPATH = $ CLASSPATH: $/opt/jdk1.6.0 _ 45/lib/dt. jar on the terminal.

4. test installation

Enter the version number on the terminal, indicating that the installation is successful.

Next, write a short piece of code to test it. In your own directory, enter vim Hello. java in the terminal and edit it.

Input command:

// Compile Hello. java. javac is the jdk compiler that compiles Hello. java into bytecode, that is, the generated Hello. class file.

Javac Hello. java

// Put the compiled bytecode In the interpreter for execution

Java Hello

The result is the most common Hello World! Output ~

 

Environment configuration complete ~

      

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.