Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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:

#!/bin/bash


#Set version JDK 32

JAVA_HOME=/opt/jdk1.7.0_25-i586
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH

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
/opt/jdk1.7.0_25-i586/bin/java
-Xms40m
-Xmx384m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
-XX:MaxPermSize=256m
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar
-os linux
-ws gtk
-arch x86_64
-showsplash
-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/eclipse_1408.so
-startup /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar
--launcher.overrideVmargs
-exitdata 24e8077
-vm /opt/jdk1.7.0_25-i586/bin/java
-vmargs
-Xms40m
-Xmx384m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
-XX:MaxPermSize=256m
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar
share|improve this question
add comment

1 Answer

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.

java.sh

#Set JDK versions
JAVA_HOME=/opt/jdk1.7.0_25
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH

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

The most popular way NOW is: https://github.com/flexiondotorg/oab-java6

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 java32.sh 
terry@tux:/opt$ which java
/opt/jdk1.7.0_25-i586/bin/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
show 10 more comments

Your Answer

 
discard

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.