Sunday, December 2, 2007

How to install Sun's JDK in Fedora 8

By default, Fedora will use GNU's version of JDK which is gcj.

To verify this, check the version by running java -version in the console and it will return
something like this :
java version "1.5.0"
gij (GNU libgcj) version 4.1.2 20070925 (Red Hat 4.1.2-33)


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.


to install Sun's JDK on Fedora 8,

1. Download the Linux self extracting rpm version of JDK from Sun's website.
Let say the rpm name is jdk-6u3-linux-i586-rpm.bin

2. Fire up the console and change directory to where the downloaded rpm is located

3. Change to root by using su and enter your root's password

4. Change the permission of the file by using chmod 755 jdk-6u3-linux-i586-rpm.bin

5. Run the file using the command ./jdk-6u3-linux-i586-rpm.bin

6. Scroll all the way down and enter yes

7. Next, enter updatedb; locate javac |grep bin
It will show you a path to the newly installed Sun's JDK.

8. Next, run these commands
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_03/bin/java 100
/usr/sbin/alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_03/bin/jar 100
/usr/sbin/alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_03/bin/javac 100

9. Lastly, to change the default JVM from gcj to Sun's version, run this command
/usr/sbin/alternatives --config java
Select the one that is from Sun and that's it!

Edit: I forgot something. There's a bug but I'm not sure whether it's Sun's or Fedora's.
but here's the fix: enter this command:
sed -i 's/XINERAMA/FAKEEXTN/g' /lib/i386/xawt/libmawt.so

Edit 2: The bug seems to be caused by libx11 having problems with assertions.
upgrade libxcb via yum and it should be fixed. The version at the moment of this edit is libxcb-1.0-4.fc8

4 comments:

Griffin Hernandez said...

Thanks man. Lets see if netbeans will install now. =)

Griffin Hernandez said...

Hm, Didnt fix it, thanks for the post though, the more knowledge on the internet the easier it is to fix a problem.

Griffin Hernandez said...

Heres the fix:
http://www.fedoraforum.org/forum/showthread.php?t=174215

Apparently when moving to Fedora 8 they upgraded the libxcb libraries. The new libraries dont fully support AWT. The fix is to get the beta FC9 libraries ( libxcb-1.1-1.fc9.i386.rpm and libxcb-devel-1.1-1.fc9.i386.rpm) from
ftp://mirrors.kernel.org//fedora/development/i386/os/Packages

When you download them do a rpm -Uvh on both of them at the same time. Then add
LIBXCB_ALLOW_SLOPPY_LOCK=1
export LIBXCB_ALLOW_SLOPPY_LOCK

To either a script that you will call or /etc/profile

You might also have to do the whole thing at the fedora forum for creating a custom rpm for your install.

That can be found at:
http://fedoraguide.info/index.php/Main_Page#Sun_Java_.28Method_2_-_jdk-6u3-linux-i586.bin_version.29

alwajdi said...

thanx for the info dude.By the way, I never installed netbeans on my machine before.
I'm an eclipse user. Will give Netbans a try soon as I heard it has improved a lot than before.