Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to transfer to 64 bit Ubuntu 12.04 from 32 bit Ubuntu 12.04.

ADT for eclipse and the Android SDK requires 32bit Java but I would like to keep the 64 bit Java that I just got installed to run with NetBeans. Is there any way to install the two side by side using apt-get or will I have to manually install the 32 bit JDK?

this is the script i am trying to use to set the path to the 32 bit JDK:


#Set version JDK 32


this is the result of running it:

enter image description here

so i manually entered each command from the script then started eclipse and got this error:

JVM terminated. Exit code=13
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar
-os linux
-ws gtk
-arch x86_64
-launcher /usr/lib/eclipse/eclipse
-name Eclipse
--launcher.library             /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.dist/
-startup /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar
-exitdata 24e8077
-vm /opt/jdk1.7.0_25-i586/bin/java
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar
share|improve this question

In your case, I would recommend using the the JDK tar.gz packages (x86 and x64) from OTN and extract it to a preferred directory, using a quick shell script to switch JDK versions, e.g.

#Set JDK versions

Another popular way to install JDK (kind of automated but a bit time consuming)

The most popular way NOW is:

NOTE: it builds .deb from OTN binaries and set up a local repository, install from there.

You can run update-alternatives --config java and see installed JDK/JRE and configure.

To be able to use 32-bit JDK on 64-bit Linux

You need to install the 32-bit shared libs (now Ubuntu uses something called Multi-arch).

If you don't have ia32-libs installed, you'll get File NOT FOUND error when running 32-bit java.

terry@tux:/opt/jdk1.7.0_25-i586/bin$ file java
java: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, BuildID[sha1]=0xb4f81805640a786538c721d745f97f3485d03e3c, not stripped
terry@tux:/opt/jdk1.7.0_25-i586/bin$ ./java
bash: ./java: No such file or directory

That's probably why the shell script didn't work.

NOTE: the script did do its job, see which output

terry@tux:/opt$ source 
terry@tux:/opt$ which java
share|improve this answer
so i would have two scripts and run one or the other depending on which jdk i want to use? – John Jul 29 '13 at 1:46
You don't have to. You can set the preferred JDK, .e.g. 64-bit in your ~/.profile or ~/.bashrc and the other using a script. – Terry Wang Jul 29 '13 at 21:13
thank you, testing it now – John Jul 29 '13 at 21:20
still getting the same error in eclipse – John Jul 29 '13 at 22:46
how can i tell if the path is set correctly after the script – John Jul 29 '13 at 22:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.