Set JDK1.5 temporarily on Ubuntu Terminal

Source: Internet
Author: User
My Ubuntu machine uses JDK 1.6 by default, but JDK 1.5 is required when compiling the Android2.2 source code, in this case, you can temporarily set JDK to 1.5 on the terminal to be compiled. The method is as follows: Create a sh file named jdk1_5.sh. The content is the installation path of your JDK1.5 as follows: exportJAVA_HOME =/home/ameyume/java/jdk1.5.0 _ 22exportJRE_HOME = $ JAVA_H

My Ubuntu machine uses JDK 1.6 by default, but JDK 1.5 is required when compiling the Android2.2 source code, in this case, you can set JDK to 1.5 on the terminal to be compiled. The method is as follows:

Create a new sh file named jdk1_5.sh. The installation path of your JDK1.5 file is as follows:

Export JAVA_HOME =/home/ameyume/java/jdk1.5.0 _ 22
Export JRE_HOME = $ JAVA_HOME/jre
Export CLASSPATH = $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH
Export PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH

Set the execution sequence of JDK1.5 as follows:

1. Check the current JDK version through java-version.

Www.linuxidc.com @ linuxidc :~ /Projects $ java-version
Java version "1.6.0 _ 24"
Java (TM) SE Runtime Environment (build 1.6.0 _ 24-b07)
Java HotSpot (TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
2. Execute the jdk1_5.sh file and set JDK1.5. You can add source to make it take effect.

Www.linuxidc.com @ linuxidc :~ /Projects $ source jdk1_5.sh
3. view the configured JDK version through java-version

Www.linuxidc.com @ linuxidc :~ /Projects $ java-version
Java version "1.5.0 _ 22"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.5.0 _ 22-b03)
Java HotSpot (TM) 64-Bit Server VM (build 1.5.0 _ 22-b03, mixed mode)
Www.linuxidc.com @ linuxidc :~ /Projects $

It indicates that the JDK version of the current terminal has been set to 1.5. It must be noted that this setting is only valid on the current terminal and is enabled again after other terminals or the terminal is closed, JDK is still the original version 1.6. When you need a JDK environment of 1.5, You need to execute this setting every time. By writing a sh batch file, it is very convenient, and you do not need to modify the JDK configuration file.

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.