Install and configure Java in fedora 8

Source: Internet
Author: User

There are three types of Java available under fedora8: the official sunjava, the open-source GNU gcj, And the sunjava-based open-source JDK (openjdk ). Standard fedora8
Install icetea. It is based on openjdk and is more complex than GNU gcj, but its performance is still different from sunjava.
Fedora8 installed Java 7 during installation, but I want to use the Java version of sun. The following describes how to install and configure it:

Log on as a root user
1) download
First in https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start? Productref = jdk-6u7-oth-JPR @ CDS-CDS_Developer download jdk-6u7-linux-i586.bin, put this file downloaded to the/OPT directory, and then enter the following command to install:

 
[Root @ localhost ~] # Cd/OPT
[Root @ localhost opt] # sh jdk-6u7-linux-i586.bin

If you do not have the read/write permission under/OPT, enter the command to add the permission.

[Root @ localhost/] # chmod A + WR OPT

2) Configuration
Configure the/etc/profile file

 
[Root @ localhost etc] # vi Profile

Add the following lines to the file:

 
Java_home = opt/jdk1.6.0 _ 07
Classpath = $ java_home/lib :.
Path = $ path: $ java_home/bin
Export java_home classpath path

Save and exit. Run the following command:

 
[Root @ localhost etc] source/etc/profile

This allows the configuration to take effect without restarting the computer.

3) change the default JVM
Now you need to run the alternatives command to instruct fedora to recognize Sun's JVM.

[Root @ localhost sbin] alternatives -- install/usr/bin/Java/opt/jdk1.6.0 _ 07/bin/Java 100
[Root @ localhost sbin] alternatives -- install/usr/bin/Jar/opt/jdk1.6.0 _ 07/bin/jar 100
[Root @ localhost sbin] alternatives -- install/usr/bin/javac/opt/jdk1.6.0 _ 07/bin/javac 100

If necessary, you can use the same format to specify other Java executableProgram.

Note: If the alternatives command is not in your path, you can use locate alternatives to locate it.

Finally, we need to configure alternative to use sun's JVM as the default JVM.
Enter the alternatives -- config Java command, and then select 3 to select the JDK version of Sun:

[Root @ localhost sbin] alternatives -- config Java
A total of three programs provide "Java ".

Select command
-----------------------------------------------
* + 1/usr/lib/JVM/jre-1.7.0-icedtea/bin/Java
2/usr/lib/JVM/jre-1.5.0-gcj/bin/Java
3/opt/jdk1.6.0 _ 07/bin/Java

Enter the Java-version command. If 1.6.0 _ 07 is displayed, the installation is successful:

 
[Root @ localhost sbin] # Java-version
Java version "1.6.0 _ 07"
Java (TM) se Runtime Environment (build 1.6.0 _ 07-b06)
Java hotspot (TM) Client VM (build 10.0-b23, mixed mode, sharing)

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.