Heads up:
We’re moving the GATK website, docs and forum to a new platform. Read the full story and breakdown of key changes on this blog.
If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We encourage our fourm members to be more involved, jump in and help out your fellow researchers with their questions. GATK forum is a community forum and helping each other with using GATK tools and research is the cornerstone of our success as a genomics research community.We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra

Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

Need to run programs that require different versions of Java

edited January 2018 in Solutions to Problems

The problem

We sometimes need to be able to use multiple versions of Java on the same computer to run command-line tools that have different version requirements. For example, at one point, GATK required an older version of Java (1.7), whereas Picard required the most recent version (1.8). Now they're both on the same version of Java (1.8), but what if you need to run something else with a different Java version requirement?

The solution(s)

First, have you considered using Docker containers? We strongly encourage you to look into them...

But if that's not an option for you, here's an alternate solution that is reasonably painless (illustrated using Java 1.7 and 1.8).

You will need to have both versions of Java installed on your machine. The Java installation package for 1.8 can be found here, and the package for 1.7 is here. Note that we point to the “JDK” (Java Development Kit) packages because they are the most complete Java packages (suitable for developing in Java as well as running Java executables), and we have had reports that the “JRE” (Java Runtime Environment) equivalents were not sufficient to run GATK on some machines.

First, check your current default java version by opening your terminal and typing java -version. If the version starts with "1.8", you will need to add the following code to the beginning of your GATK command to specify that it should be run using version 1.7. Note that this is not compatible with the use of the gatk wrapper script.


If your default version starts with “1.7”, then you will need to prepend the code below to your Picard command:


You may need to change the orange part in each code snippet, which should refer to the specific version of java you have installed on your machine (version and update). To find that, simply navigate to the folder where you had installed the JDK. Under the “JavaVirtualMachines” folder, you should find JDK folders that name the specific version and update.

Post edited by Geraldine_VdAuwera on
Sign In or Register to comment.