Skip to content

Instantly share code, notes, and snippets.

@alxsimo
Created September 1, 2015 21:23
Show Gist options
  • Save alxsimo/606711393cccdd8ae083 to your computer and use it in GitHub Desktop.
Save alxsimo/606711393cccdd8ae083 to your computer and use it in GitHub Desktop.
[Ubuntu] Install Java on Ubuntu 15.04
My way is to remove OpenJDK, add the webupd8team's PPA and install 64-bit java8 as a packet.
Code:
sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
I also tried oracle-java8-installer, but it looks like Juniper NC doesn't work with it.
Than you go to java.com and download a tar.gz 32-bit bundle for Java Linux (32-bit version is named simply “Linux” on the download page). Here is how it should look like:
Code:
$ ls
jre-8u45-linux-i586.tar.gz
$ tar xfs ./jre-8u45-linux-i586.tar.gz
$ ls -lh
total 63M
-rw-rw-r-- 1 pash pash 63M Apr 28 16:02 jre-8u45-linux-i586.tar.gz
drwxr-xr-x 6 pash pash 4.0K Apr 10 20:53 jre1.8.0_45
Manually install it (you might want a better path location but this is how I like it):
Code:
sudo mv ./jre1.8.0_45 /usr/lib32/
sudo chown root.root /usr/lib32/jre1.8.0_45/ -R
sudo ln -s /usr/lib32/jre1.8.0_45 /usr/lib32/java
Now you have two versions of java, but you need to tell the system about both and how to chose which one to use. A mechanism called update-alternatives is used to mantain different programs with same names.
Code:
$ sudo update-alternatives --install /usr/bin/java java /usr/lib32/java/bin/java 10
update-alternatives: using /usr/lib32/java/bin/java to provide /usr/bin/java (java) in auto mode
$ update-alternatives --display java
java - auto mode
link currently points to /usr/lib32/java/bin/java
/usr/lib/jvm/java-8-oracle/jre/bin/java - priority 1
slave java.1.gz: /usr/lib/jvm/java-8-oracle/man/man1/java.1.gz
/usr/lib32/java/bin/java - priority 10
Current 'best' version is '/usr/lib32/java/bin/java'.
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib32/java/bin/java 10 auto mode
1 /usr/lib/jvm/java-8-oracle/jre/bin/java 1 manual mode
2 /usr/lib32/java/bin/java 10 manual mode
Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/java to provide /usr/bin/java (java) in manual mode
$ update-alternatives --display java
java - manual mode
link currently points to /usr/lib/jvm/java-8-oracle/jre/bin/java
/usr/lib/jvm/java-8-oracle/jre/bin/java - priority 1
slave java.1.gz: /usr/lib/jvm/java-8-oracle/man/man1/java.1.gz
/usr/lib32/java/bin/java - priority 10
Current 'best' version is '/usr/lib32/java/bin/java'.
This output means that you told update-alternative that 32-bit java is present but asked to use 64-bit version by default. When Juniper NC needs 32-bit version it will check the list and find the path.
Now you follow the Juniper's KB25230 and install the required 32-bit libs:
Code:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libstdc++6:i386 lib32z1 lib32ncurses5 lib32bz2-1.0 libxext6:i386 libxrender1:i386 libxtst6:i386 libxi6:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package lib32bz2-1.0
E: Couldn't find any package by regex 'lib32bz2-1.0'
I believe lib32bz2-1.0 was present in 14.10 but is missing in 15.04 for some reason. No problem, first skip it:
Code:
sudo apt-get install libstdc++6:i386 lib32z1 lib32ncurses5 libxext6:i386 libxrender1:i386 libxtst6:i386 libxi6:i386
I didn't check myself whether NC will work without lib32bz2-1.0 installed, as I simply got it from here: https://launchpad.net/ubuntu/vivid/a...1.0.6-5ubuntu5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment