Install and configure JDK 7 in Ubuntu11.04. Step 1: Download jdk-7-linux-i586.tar.gz [plain] wget-c http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz (Note: If the download fails, we recommend that you use thunder to download it. then, install and configure JDK 7 in Ubuntu 11.04. Step 1: Download jdk-7-linux-i586.tar.gz [plain] wget-c. http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz (Note: If the download fails, we recommend that you use thunder to download it and copy it to the Linux system .) Step 2: unzip and install [plain] sudo tar zxvf. /jdk-7-linux-i586.tar.gz-C/usr/lib/jvm cd/usr/lib/jvm sudo mv jdk1.7.0/java-7-sun Step 3: modify the environment variable [plain] vim ~ /. Add bashrc: www.2cto.com [plain] export JAVA_HOME =/usr/lib/jvm/java-7-sun export JRE_HOME =$ {JAVA_HOME}/jre export CLASSPATH =.: $ {JAVA_HOME}/lib :$ {JRE_HOME}/lib export PATH =$ {JAVA_HOME}/bin: $ PATH save and exit. enter the following command to make it take effect immediately. [Plain] source ~ /. Bashrc Step 4: configure the default JDK Version. Because ubuntu may have the default JDK, such as openjdk, the following work is required to set the installed JDK to the default JDK Version. Run the code: [plain] sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/java-7-sun/bin/java 300 sudo update-alternatives -- install/ usr/bin/javac/usr/lib/jvm/java-7-sun/bin/javac 300 sudo update-alternatives -- install/usr/bin/jar/usr/lib /jvm/java-7-sun/bin/jar 300 sudo update-alternatives -- install/usr/bin/javah/usr/lib/jvm/java-7-sun/bin /javah 300 sudo update-alternati Ves -- install/usr/bin/javap/usr/lib/jvm/java-7-sun/bin/javap 300 run the code: [plain] the sudo update-alternatives -- config java www.2cto.com system lists various JDK versions, as shown below: [plain] snowdream @ snowdream :~ $ Sudo update-alternatives -- config java has three candidates to replace java (/usr/bin/java ). Select path priority status ready * 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 automatic mode 1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode 2/usr/lib/jvm/java-6-sun/jre/bin/java 63 Manual Mode 3/usr/lib/jvm/java-7-sun/bin/ to maintain the current value in java 300 manual mode www.2cto.com [*], press the Enter key, alternatively, enter the selected number: 3 update-alternatives:/usr/lib/jvm/java-7-sun/bin/java to provide/usr/bin/java (java ), in manual mode. Step 5: Test [plain] snowdream @ snowdream :~ $ Java-version java version "1.7.0" Java (TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot (TM) Server VM (build 21.0-b17, mixed mode) author yang_hui1986527
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.