The Frontline Support team will be slow to respond December 17-18 due to an institute-wide retreat and offline December 22- January 1, while the institute is closed. Thank you for your patience during these next few weeks. Happy Holidays!
Java version issues
As documented here, GATK requires a particular major version of Java. If you try to run it with any other version, you'll get an error that will include this line:
Unsupported major.minor version
To sidestep this sort of problem entirely, we recommend using the Docker container system, if that's an option on your infrastructure, because that takes care of all software requirements and dependencies for you. You can check out a tutorial on using GATK through Docker here. But if that's not an option for you, read on.
- Checking your Java version
- Upgrading your version of Java
- Selecting between different versions of Java on the same system
1. Checking your Java version
You can check your Java version by opening your terminal application and running the following command:
The bit of the output that we care about here is the line that says something like
java version "1.8.0_65".
2. Upgrading your version of Java
Depending on your operating system this can be more or less painful. Generally it's a matter of going to either the Oracle website or the OpenJDK website and picking the distribution that matches our version requirements and your operating system. To find this, Google is your friend. Then follow the instructions provided by Oracle or OpenJDK.
The most common problem we see people run into is that on MacOSX, if you get the Oracle JRE (Java Runtime Environment) package, installing the new Java version doesn't automatically make it available to run in the terminal -- and depending on versions we've had a tough time figuring out out to address that. However, we find that if you get the JDK (Java Development Kit) package instead, everything works right away. So get that package, and don't be put off by the "Development Kit" bit in the name; there's no difference from the end-user perspective.
3. Selecting between different versions of Java on the same system
Yes, it is possible to have several different versions of Java installed on your system! There are several ways to manage this; here's a way to do it that we find reasonably straightforward.
Let's say your system is set up to use Java 1.8 by default, but for some reason (to replicate an old analysis?) you need to run an older version of GATK that requires Java 1.7. Well, you can specify which version of Java you want to invoke by doing this:
You may need to change the orange part in the command, which should refer to the specific version of java you have installed on your machine (version and update). To find that, navigate to the folder where you installed the JDK. Under the “JavaVirtualMachines” folder, you should find JDK folders that name the specific version and update.