Skip to main content

Java runtime environment on fedora 14

·3 mins

The standard installation of Fedora comes with OpenJDK off of Sun Java. However if not, it can be installed using YUM: yum install java-1.6.0-openjdk java-1.6.0-openjdk-plugin If you installed OpenJDK, all the ava application and web applets should automatically work. Unfortunately some applets may not run properly and the OpenJDK might have some limitations. Majority of user should find OpenJDK perfect for everyday use.

Installing Sun Java: Download java from here: http://www.java.com/en/download/manual.jsp?locale=en&host=www.java.com

Always use the latest update. Select Java JRE 6 Update 18 (the JDK is for developers) On the next page, for Platform select “Linux” for 32-bit users, and “Linux x64” for 64-bit users. For Language select “Multi-language”. Also accept the license agreement, and hit “Continue”.

On the next page, select the RPM option: 64bit - jre-6u22-linux-x64-rpm.bin or 32bit - jre-6u22-linux-i586-rpm.bin

Installation: For 64bit: #sh jre-6u18-linux-i586-rpm.bin For 32bit: #sh jre-6u18-linux-x64-rpm.bin

You will need to hit ‘space’ till it reaches the end, then type ‘yes’. It should install the RPM files automatically, but if it doesn’t install then you can manually install it using RPM command rpm -ivh

Now, if you run command #java -version, you will see that by default its running java from OpenJDK. In order to use Sun Java, use the alternatives command.

In Fedora you can use alternatives to have multiple versions of java installed on your system and change between then as and when required.

Running the following command(for both 32-bit and 64-bit users): # /usr/sbin/alternatives –install /usr/bin/java java /usr/java/default/bin/java 20000

Explanation: alternatives –install
name: is the generic name for the master link. link: is the name of its sym‐link. (this link will be created by alternatives, so don’t try to look up the path, it won’t be there unless you have run alternatives command earlier) path: is the alternative being introduced for the master link. priority: is the priority of the alternatives group. Higher priorities take precendence if no alternative is manually selected.

Setup the Mozilla/Firefox browser plugin. For 32-bit users: # /usr/sbin/alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/default/lib/i386/libnpjp2.so 20000 For 64-bit users: /usr/sbin/alternatives –install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/default/lib/amd64/libnpjp2.so 20000 Note: don’t try to locate the file libjavaplugin.so in mozilla/plugins directory, it won’t be there by default. Actually, alternatives is going to create a symbolic link with that name in mozilla/plugins directory which will point to configured javaplugin using alternatives. So, just type in the above command as it’s and hit the enter.

You need to restart firefox to see the plugin take effect.

You can run following commands to change between different versions of java as per your needs.

/usr/sbin/alternatives –config java /usr/sbin/alternatives –config libjavaplugin.so (or for 64-bit) /usr/sbin/alternatives –config libjavaplugin.so.x86_64 Above commands will show all the different versions of java available under alternatives control, and which one is default setup, you can change the default settings by using the numbers displayed on screen.

You can use the following command to see current settings for java /usr/sbin/alternatives –display java and similarly for others. It will display the current default java in use.

– Sandeep Sidhu