Welcome to the Homepage of Senthil Nachimuthu
Installing 64-bit JDK 5 and Eclipse on x86_64 Print E-mail
User Rating: / 1
PoorBest 
Sunday, 03 September 2006
Okay, you installed Eclipse on your 32 bit Linux machine, and it worked fine and dandy. You try that on your 64-bit Linux (Athlon64) machine with a 64-bit JDK (I used JDK 5) and it gives you cryptic error messages, and you begged and prayed and googled and still no effect? Here's the answer.
I installed JDK 5 (JDK 1.5.0_01, I hate Sun's version numbering. Sometime soon we will have a JDK 9800067000) from an rpm and it installed fine. Then I downloaded Eclipse 64-bit and extracted  it into a proper location (/usr/local/eclipse) and it just doesn't work. It gave me a cryptic error message saying "An error has occurred. See the log file "/usr/local/eclipse/configuration/1106984649831.log"

When I look at that log file, I see a really cryptic message:

!SESSION Jan 29, 2005 00:44:10.925 ---------------------------------------------
eclipse.buildId=M200409161125
java.version=1.4.2_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=amd64, WS=gtk, NL=en_US

!ENTRY org.eclipse.osgi Jan 29, 2005 00:44:10.926
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: /usr/local/eclipse/plugins/org.eclipse.swt.gtk64_3.0.1/os/linux/amd64/libswt-pi-gtk-3063.so: /usr/local/eclipse/plugins/org.eclipse.swt.gtk64_3.0.1/os/linux/amd64/libswt-pi-gtk-3063.so: cannot open shared object file: No such file or directory
But the file is right there, in the location where it says it cannot find it. How crazy?

I searched all over the Internet, with no avail. Finally, when I had sworn enough at Eclipse, I noticed that the top of the file said java.version said 1.4.2_06. But I had installed JDK 5 (or 1.5) just recently.

When I typed "java -version" on a shell, I got:
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

So, I found out the installation directory of JDK5, and changed all references to Java and JRE to that location. These are the things I did:

If found the file /etc/java/java.conf and changed it to:

# System-wide Java configuration file                                -*- sh -*-
#
# JPackage Project <http://www.jpackage.org/>
# Location of jar files on the system
#JAVA_LIBDIR=/usr/share/java
JAVA_LIBDIR=/usr/java/jdk1.5.0_01/lib
# Location of arch-specific jar files on the system
#JNI_LIBDIR=/usr/lib/java
JNI_LIBDIR=/usr/java/jdk1.5.0_01/lib
# List of known java homes (used for autodetection if none is provided)
#JAVA_HOME_LIST=$JAVA_LIBDIR-utils/java_home.list
#JAVA_HOME_LIST=$JAVA_LIBDIR-utils/java_home.list
# Root of all JVM installations
#JVM_ROOT=/usr/lib/jvm
JVM_ROOT=/usr/java/jdk1.5.0_01
# Default jvm
#JAVA_HOME=$JVM_ROOT/java
JAVA_HOME=$JVM_ROOT/java
# Options to pass to the java interpreter
#JAVACMD_OPTS=
JAVACMD_OPTS=
Note that in the above file, I commented out the old values and inserted the new values.

One more thing needs to be done now. The symbolic link

/usr/bin/java needs to be changed to point to the new java in the JDK5 directory. Once I do this, Eclipse starts fine. Voila!

But then, I need to change so many symlinks if I want to run JDK5 successfully. You can do this if you want. But I wanted to dump JDK 1.4.2 and just keep JDK 1.5,  and compile it in compatibility mode when required.

So, I uninstalled JDK 1.4.2 and reinstalled JDK 1.5 (which was incidentally removed by a Yast Online Update). Uninstallation was done using Yast > Software > Install and Remove software. I searched for "java" and removed everything starting with java-1_4_2. It warned me about several dependencies, but I clicked on ignore and uninstalled it.

Then, I reinstalled JDK 1.5.0_01 for AMD64 from an rpm file that I downloaded from the Sun website. Finally, I need to configure some environment variables, so that other programs can find the Java programs in the right place. This is what my profile.local looks like after these changes:

export JAVA_LIBDIR=/usr/java/jdk1.5.0_01/lib
export JNI_LIBDIR=/usr/java/jdk1.5.0_01/lib
export JAVA_HOME=/usr/java/jdk1.5.0_01
export JVM_ROOT=/usr/java/jdk1.5.0_01
export JRE_HOME=$JAVA_HOME/jre

export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

export MOZILLA_FIVE_HOME=/usr/lib/mozilla
export ECLIPSE_HOME=usr/local/eclipse
export CLASSPATH=$CLASSPATH:/usr/local/eclipse/plugins/org.eclipse.swt.gtk64_3.0.1/ws/gtk/swt.jar
export CLASSPATH=$CLASSPATH:/usr/local/eclipse/plugins/org.eclipse.swt.gtk64_3.0.1/ws/gtk/swt-pi.jar
export CLASSPATH=$CLASSPATH:/usr/local/eclipse/plugins/org.eclipse.swt.gtk64_3.0.1/ws/gtk/swt-mozilla.jar

Now, if I type "java -v" at a command prompt, I get this output:

java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_01-b08, mixed mode)

Compare this with the above output. This leads me to think that the version of jdk 1.4.2 installed by default in SuSe 9.2 Professional x86_64 is a 32 bit version. It doesn't say 32 bit, but it doesn't say 64 bit either, which the latter does.

Now, if I type "/usr/local/eclipse/eclipse" at the command prompt, Eclipse starts without a problem. (It actually nagged about not finding a JRE, but I rebooted the machine to get rid of all the old environment variables, and Eclipse started like a charm).

Now, let's go have some Espresso, made from Java beans.


More links:
Refer to this thread too. It might be of some use.




Digg!Reddit!Del.icio.us!Google!Live!Slashdot!Netscape!Technorati!StumbleUpon!Spurl!Newsvine!Furl!Blogmarks!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!
Last Updated ( Sunday, 03 September 2006 )
 
< Prev
Creative Commons License Copyright 2004-2008 Senthil Nachimuthu. Some rights reserved. The original work on this website is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Powered by Joomla