|CCL Sun Java Development Kit on FC6|
For Fedora Core 5 (FC5) version of this page look [ Here ].
For Fedora 7 (F7) version of this page look [ Here ].
What is the problem with FC6 and JDK from Sun?
Several people told me that the instructions
here do not work with the latest 1.5.0_10 from Sun. Use 1.5.0_09-fcs
for the time being. As you may know Sun is releasing the JDK source
code and for this reason alone the whole idea of "compat" may not
be a long term vision. The last time I searched Google for
1.5.0_09-fcs something like this came out:
Fedora Core 6 Linux distribution comes with the GNU Java. This is a part of the popular GNU C compiler suite that also includes support for other programming languages, like Fortran. The GNU Java now supports most of the features of Sun Java 1.4 and in many cases can be augmented by additional open source packages to be almost functionally equivalent to the latest JDK from Sun. It has also some important advantages (e.g., option to produce native machine code) but it is by necessity behind with the features of the latest Java Development Kit from Sun. More information can be found at the GNU Compiler for the Java page at: http://gcc.gnu.org/java/. Recently Sun announced that it is legal to redistribute their Java Development Kit, however, it is unlikely that it will be a part of Fedora. The reason for this is that Sun Java Development Kit is not provided with the source code, while the Fedora Core Linux only provides packages that are open source.
In most cases you will be fine with the Open Source, GNU Java. Most open source projects that need Java Development Kit do work with the GNU Java. But some do not... Especially those that push latest standards to the limits and require the latest features of the Java SDK from Sun. With the race to new standards for Java, you may need the Sun's Java SDK, but you also do not want to break the code that assumes that GNU Java is available on your machine. You will definitely need the Sun JDK if you use their latest and greatest IDEs or Enterprise type solutions. But YOU DO NOT WANT TO BRUTALLY DELETE/UNINSTALL the GNU Java or just put the Sun JDK into /opt and change the $JAVA_HOME and $CLASSPATH. Luckily there is a nice solution via alternatives package that comes with Fedora. We are even more lucky that there is a JPackage.org project and that Fedora supports it.
Make Sun JDK your default
Start from becoming a root by logging in as root or by sudo or simply by:
and get the latest JDK from Sun
Select the Java 2 Platform, Standard Edition (J2SE).
Choose the latest edition (at this writing it was 1_5_0_09,
i.e., JDK 5.0 Update 9) and get the Linux RPM in self-extracting
file (DO NOT DOWNLOAD Linux self-extracting file!). You should
get a file like jdk-1_5_0_09-linux-i586-rpm.bin
that is about 45 MBytes in size. If it does not have
the rpm.bin at the end, you took the wrong one.
While you are downloading this large file, please downloads the keys for the JPackage repository:
rpm --import http://jpackage.org/jpackage.asc
and install the JPackage repository information for the yum:
cd /etc/yum.repos.d wget http://jpackage.org/jpackage.repo
If it did not work, maybe you do not have wget. You can check it with:
rpm -qi wget
and if you do not have it, install it with:
yum install wget
and try again to get the jpackage.repo file.
The jpackage.repo file comes with the jpackage-general
repository enabled. However, I personally disabled the automatic
retrieval of updates and packages from the
repository by editing the /etc/yum.repos.d/jpackage.repo
file and changing line(s) enabled=1 to the
enabled=0 . I do not want to
risk the situation when, due to some dependency, the new Java packages
will be installed on my machine without my knowledge during
updates that are run automatically at night. Moreover,
Fedora Core 6 default Java packages are already in the
Fedora repositories (i.e., were officially blessed
by Fedora team), and it is probably better to
try these repositories first than to go directly to the JPackage.org and
risk messing up some naming convention and/or dependencies.
At the same time, JPackage repository can be always enabled
in yum by adding the:
rpm -qi rpm-build rpm -qi fedora-rpmdevtools
If you do not have them, install them:
yum install fedora-rpmdevtools yum install rpm-build
Check if you have packages for GNU Java compiler/libraries installed, since you most likely need to have some symmetry between GNU and Sun JDKs so the alternatives is not confused. But, frankly, I do not know the intrinsics of it, though it cannot hurt and disk space is cheap.
yum list available '*gcj*'
will list the available but not installed yet pieces of gcj (GNU Java compiler) and you can install these packages as:
yum install package1 package2...
Please read the man page for alternatives:
When your Sun JDK Linux RPM self-extracting file finally arrives you need to execute it, since it is a shell script. It contains the license agreement and the compressed RPM package with Sun JDK. It will ask you if you agree to the long license. Say yes, then it will uncompress the RPM with JDK, and then it will install it. To run it do:
chmod 755 jdk-1_5_0_09-linux-i586-rpm.bin ./jdk-1_5_0_09-linux-i586-rpm.bin
Unfortunately, the Sun RPM package puts files
in different locations than the ones required by Fedora Core 6.
After running the script you will see a new directory
/usr/java/jdk1.5.0_09 with JDK files. Note that the
actual RPM is left in the directory where you ran the Sun's
jdk-1_5_0_09-linux-i586-rpm.bin script, however,
you do not need to process the RPM, since script already did it.
You may, however, use the RPM package if you want to install
the JDK on another machine or if you erased the JDK at some point
with a the RPM's
yum --enablerepo=jpackage-generic-nonfree install java-1.5.0-sun-compat
This will create a bunch of links in the /etc/alternatives and /usr/lib/jvm directories and others to the /usr/java/jdk1.5.0_09 directory where the Sun JDK distribution resides. To check which files were affected do:
rpm -q -l java-1.5.0-sun-compat
Check if the Sun JDK is really a default by doing:
If you get:
java version "1.4.2" gij (GNU libgcj) version 4.1.1 20060525 (Red Hat 4.1.1-1) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(or similar) then something did not work. If you get:
java version "1.5.0_09" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03) Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing)
then the Sun JDK is your default. You can use alternatives to check (or change) the default JDK by:
alternatives --config java
It should show something like:
There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java *+ 2 /usr/lib/jvm/jre-1.5.0-sun/bin/java Enter to keep the current selection[+], or type selection number:
Hit [Enter] key if you want Sun JDK to be a default, or enter 1 if you want to change back to GNU Java. The JPackage compatibility should also make you a link for Java plug-in for Firefox browser. To make sure it did, do:
cd /usr/lib/mozilla/plugins ls -l
If you get:
lrwxrwxrwx 1 root root 77 Jun 17 20:47 libjavaplugin_oji.so -> /usr/lib/jvm/java-1.5.0-sun-1.5.0.09/jre/plugin/i386/ns7/libjavaplugin_oji.so
you should be fine. If you do not have it, make this link yourself (but then worry, since something is not right):
cd /usr/lib/mozilla/plugins ln -s /usr/lib/jvm/java-1.5.0-sun-1.5.0.09/jre/plugin/i386/ns7/libjavaplugin_oji.so \ libjavaplugin_oji.so
The Firefox should look for plug-ins in the /usr/lib/mozilla/plugins directory. If your Firefox still does not work with Java, put the link above also in the directory /usr/lib/firefox-184.108.40.206/plugins, or whatever is your particular version of Firefox that you can dig out from the script that runs it: /usr/bin/firefox or whatever is reported by:
There are different distros of Firefox, so you
may be special but for your own sake, use yum to
yum erase java-1.5.0-sun-compat rpm -e jdk-1.5.0_09-fcs
Be bold... Do not worry... You can always reinstall it as described above. Of course, you can choose to use rpm command directly rather than yum to work with packages. But yum has a lot of advantages, since it will maintain the packages and upgrades and makes a lot of checks to see if things will not break. But sometimes they break. A popular situation is when you used rpm to install some package (or the package was installed with an install (older package is kept) rather than an update (older package is removed). In this case, yum gets confused with dependencies and complains, and it does not want to install a package. To see if this is a case, list all the installed rpm packages for some package name with a command:
rpm -qa | grep "^java" | sort
(Helpful suggestion from Bob Gustafson, Thanks!)
for example. If you see two versions of the same rpm, just erase the older (i.e., with the lower revision number) one. Use the
rpm -e full_package_name_with_version
(but skip the .rpm) and then
rpm -qa | grep "java-1.5.0-sun-compat" java-1.5.0-sun-compat-1.5.0.09-1jpp java-1.5.0-sun-compat-220.127.116.11-1jpp
remove the older package as:
yum erase java-1.5.0-sun-compat-1.5.0.09-1jpp
or, if still no go:
rpm -e java-1.5.0-sun-compat-1.5.0.09-1jpp
rpm -e --nopostun java-1.5.0-sun-devel-1.5.0.09-1jpp rpm -e --nopostun java-1.5.0-sun-1.5.0.09-1jpp
[ in general, if you see the error:
(Suggestions above from Bob Gustafson, Thanks!)
and check again if something is still left with:
rpm -qa | grep "^java" | sort
If you are still stuck, try deleting the Sun JDK first, e.g.:
rpm -e jdk-1.5.0_09-fcs
and then try to delete the compat RPMs again. This problem showed up lately while upgrading JDK and we still do not know if this is an ugly bug or an interesting feature.
So... Where the heck is my JAVA_HOME? Relax...
JAVA_HOME=/usr/lib/jvm/java export JAVA_HOME
or if you are C-shellish:
setenv JAVA_HOME /usr/lib/jvm/java
Jan K. Labanowski
If you think that I erred, please let me know and I will be thankful and will correct... I promise... One more thing (a disclaimer...): If you believed in anything what I said, and lost time and money, it is your fault... I am telling you again... I may have made a mistake, and I do not guarantee that anything will work as described...jkl at ccl . net
|Modified: Tue Sep 4 04:16:04 2007 GMT|
|Page accessed 124768 times since Sat Jun 17 15:23:37 2006 GMT|