Java JDK Install on Unix 32-bit and 64-bit

For example, our SliceHost system is 64 bit, and we want to be able to run 32 bit programs.

Before you begin

You may want to verify your Ubuntu /etc/apt/sources.list

You may want to remove Linux Java GCJ pacakage

To install Java via download from Sun

Go to

Download jdk-6u16-linux-x64.bin (or whichever version is most current for your particular system)

Put it in ~root/sources/ (or wherever you like)

Run it, which prompts you to approve the license, and unpacks Java.

Put it wherever you like e.g.:

  $ mv jdk1.6.0_17 /opt/
  $ cd /opt
  $ ln -s jdk1.6.0_17 jdk

To install Java via Debian packages

To install via ubuntu packages which may be slightly out of date:
  apt-get install sun-java6-bin ia32-sun-java6-bin

To choose between Java 32 bit and Java 64 bit

To choose:
  update-alternatives --config java

To verify that Java works

To verify:
  $ /opt/jdk/java -version
  java version "1.6.0_17"
  Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
  Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

To install Java JDK versions for 32 bit and 64 bit side-by-side

To put the two versions of Java in unique system directory names:
    $ rm -rf jdk1.6.0_17
    $ sh jdk-6u16-linux-i586.bin
    $ mv jdk1.6.0_17 /opt/jdk1.6.0_17_i586

    $ rm -rf jdk1.6.0_17
    $ sh jdk-6u16-linux-x64.bin
    $ mv jdk1.6.0_17 /opt/jdk1.6.0_17_x64

To create a symlink for convenience:

    $ ln -s /opt/jdk1.6.0_17_i586 jdk

To add the JDK to your system path:

  export PATH

What's Next?

blog comments powered by Disqus