Dec 202011
 

Between Oracle and the various GNU/Linux distributions the damn Java ball has been dropped!
Really unprofessional from both sides, I don’t care for the technicalities, both sides screwed up and your users are suffering.

Basically along with Oracle’s security update 29 the terms that allow Linux distributions to distribute the Sun JRE and JDK have been removed. This required Debian/Ubuntu/Mint to remove the package as per this bug report.

So what the hell are our Java options for production servers?

Turns out that the only real solution at the moment is to manually download and install the JRE / JDK from Oracle. Which may be exactly what Oracle wants but for production software there really is no other option:

  • Production servers must be security patched.
  • We can’t hope that production code will work 100% on openJDK.
  • OpenJDK-6 is in Debian Squeeze, but openJDK-7 was not.
  • IntelliJ IDEA does not support openJDK.
  • It would be madness to develop on one JDK and deploy on another at this stage.

Further Oracle’s license terms are not fun and include a ‘call home’ function…grumble…

Anyway until this mess is corrected by the parties involved download the Oracle JDK:

Register for email security update notifications:

Follow this Debian/Ubuntu how to:

My JDK install steps:

  1. Install openjdk-7-jre OR openjdk-7-jre-headless to keep Debian package dependencies happy.
  2. Remove all sun-java6-* packages (BIG security holes remember...)
  3. Ensure that any browser plug-in's are removed (icedtea-plugin, sun-java6-plugin).
  4. For 32bit OR for 64bit:
  5. mkdir -p /usr/local/bin/java/32 OR mkdir -p /usr/local/bin/java/64
  6. cd /usr/local/bin/java/32 OR cd /usr/local/bin/java/64
  7. Download: wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7uXX-bXX/jdk-7uXX-linux-yyy.tar.gz"
  8. tar zxvf jdk-7uXX-linux-yyy.tar.gz
  9. ln -s /usr/local/bin/java/32/jdk1.7.0_XX /usr/local/bin/oracle-java-default OR ln -s /usr/local/bin/java/64/jdk1.7.0_XX /usr/local/bin/oracle-java-default
  10. update-alternatives --install "/usr/bin/java" "java" "/usr/local/bin/oracle-java-default/bin/java" 1
  11. update-alternatives --set java "/usr/local/bin/oracle-java-default/bin/java"

Further for Android development:

  1. update-alternatives --install "/usr/bin/keytool" "keytool" "/usr/local/bin/oracle-java-default/bin/keytool" 1
  2. update-alternatives --set keytool "/usr/local/bin/oracle-java-default/bin/keytool"
  3. update-alternatives --get-selections | grep java

Note: that we can now use our /usr/local/bin/oracle-java-default symlink in all further setup.
Note: that XX must be replaced by the latest version and yyy must be replaced by x64 or i586 in the above steps.

To install browser plugin for each user:

  1. In Iceweasel/Firefox Tools -> Add-ons -> Plugins -> Disable Java Plugin.
  2. Copy the three commands below, shut browser down.
  3. mkdir ~/.mozilla/plugins
  4. rm ~/.mozilla/plugins/libnpjp2.so
  5. ln -s /usr/local/bin/oracle-java-default/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/ OR ln -s /usr/local/bin/oracle-java-default/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
  6. Start browser and check that Add-ons shows correct Java Plugin version.

To setup Tomcat:

  1. Edit: nano /etc/environment
  2. Set: JAVA_HOME=/usr/local/bin/oracle-java-default
  3. Edit: nano /etc/default/tomcat6
  4. Set: JAVA_HOME=/usr/local/bin/oracle-java-default

To upgrade Java version using our symlink:

  1. cd /usr/local/bin/java/32/ OR cd /usr/local/bin/java/64
  2. Download (see wget command above), extract: tar zxvf jdk-7uXX-linux-yyy.tar.gz
  3. rm /usr/local/bin/oracle-java-default
  4. ln -s /usr/local/bin/java/32/jdk1.7.0_XX /usr/local/bin/oracle-java-default OR ln -s /usr/local/bin/java/64/jdk1.7.0_XX /usr/local/bin/oracle-java-default

To check Java versions:
$ java -version
visit http://java.com/en/download/installed.jsp

UPDATE note on Java 6:
Java 6 (6u45-b06) is listed as an archive historical version on Oracle.com
The wget link will not work exactly as posted above.
To download an oracle.com account is required.
Oracle Java Archive

Gavin Kromhout:


Thank you for visiting.
Do look around.
Do leave a comment.

  4 Responses to “Oracle (Sun) Java JDK for Debian, Ubuntu, Linux Mint”

  1. I guess any future framework need will be filled by Yii for me. Grails is awesome, but Oracle has come to kill the party.

  2. Or back to Python :-O I have had a few people tell me it’s pretty good for web development now. Na stuff it just use Javascript from front to back!

  3. hmmmmm, Just straight C using cgi. Yep, that’s the winner, not going to change any time soon.

    ๐Ÿ˜›

  4. Webupd8 provides a repo now so you get the updates automatically.
    It’s a PPA in Ubuntu, so super easy, but for Debian it’s still very straight forward, just use the traditional edit of sources, update and install.
    I’ve been using it for ages now, mainly for minecraft servers ๐Ÿ˜‰

    http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)