How to install Java and JavaWS in Linux

Last night I’ve learnt Oracle changed the Java licensing which broke all channels of installation typically used in Linux.

Still, you can obtain & install Java and JavaWS free-of-charge manually for personal and developmental use. This is how to proceed:

cd ~/Download
tar xpfz jre-8u211-linux-x64.tar.gz
  • Move folder to `/opt/java`
sudo mkdir -p /opt/java
sudo mv jre1.8.0_211 /opt/java
  • Remove or rename symbolic links if they exists
which java
which javaws
ls -la /usr/bin/java*
sudo rm /usr/bin/java*
  • Link new java version
sudo ln -s /opt/java/jre1.8.0_211/bin/java /usr/bin
sudo ln -s /opt/java/jre1.8.0_211/bin/javaws /usr/bin

Now everything should work just fine 🙂

GATK error: CommandLineGATK : Unsupported major.minor version 51.0

If you see an error: CommandLineGATK : Unsupported major.minor version 51.0), while running new GATK, this means you most likely need newer java. Either:

  • Install the latest java with apt-get (if you have root access and Ubuntu/Debian)
  • sudo apt-get install oracle-java9-installer
  • Or download JRE from Oracle website and and set up system $PATH
    ie. if you have your JRE unpacked in ~/src/jre add these lines to your ~/.bashrc:
  • #java RE
    export PATH=~/src/jre/bin:$PATH
    

    And open new terminal window.

You can check installed JRE version with

java -version

The location of `java` binaries can be checked with

which java