We'll take a look at the install and configure the Sun x64 JDK using on Fedora Core 8. Also, I'll explain how to set up the necessary symbolic links so that Fedora uses Sun Java instead of gcj.
1. Download Sun JDK
First you'll need to download the JDK. This can be found at http://java.com/en/download/manual.jsp. Select Linux RPM (self-extracting file). Download this file. At the time of writing, the current version is jdk 6 update 6, so jdk-6u6-linux-x64-rpm.bin was the file downloaded.
2. Install Sun JDK
Execute the following command to make the installer executable:
$ chmod +x jdk-6u6-linux-x64-rpm.bin
Now execute the file:
You'll be presented with the Sun License. Accept it. The JDK will then be installed to /usr/java:
$ ls -l /usr/java
total 3
default -> /usr/java/latest
jdk1.6.0_06
latest -> /usr/java/jdk1.6.0_06
3. Configure Fedora
Now the JDK is installed, but we need to tell the system to use this JDK for java programs. To this end, we must configure the system using the alternatives program:
$ /usr/sbin/alternatives --install \
/usr/bin/java java /usr/java/jdk1.6.0_06/bin/java 20
This tells the system that there is an "alternative" installation of java at /usr/java/jdk1.6.0_06, and that this installation has priority 20. The priority you should choose varies, depending on the priority of other java alternatives, like gcj. In the end, you want your Sun JDK to be the highest priority so that it is the default alternative. To see what the various priorities are for all java alternatives, execute the following:
$ /usr/sbin/alternatives --display java
This will show you a list of all the java alternatives, and their respective priorities. Make sure the Sun JDK is the highest priority.
Alternatively, you may explicitly tell the alternatives program to use your Sun JDK for java. This will cause your Sun JDK to be the system choice for java, regardless of priority:
$ /usr/sbin/alternatives --config java
This will present you with a menu of java alternatives. Choose the one corresponding to /usr/java/jdk1.6.0_06.
Repeat the above process for the javac command:
$ /usr/sbin/alternatives --install \
/usr/bin/javac javac /usr/java/jdk1.6.0_06/bin/javac 20
4. Verify Setup
Finally, verify your installation is the one used by the system:
$ java -version
java version "1.6.0_05"
Java(TM) SE Runtime Envioronment (build 1.6.0_05-b13)
Java Hot Spot(TM) 64-Bit Server VM (build 10.0-b19, mixed mode)
$ javac -version
javac 1.6.0_06
No comments:
Post a Comment