This article is now archived.
WDL articles now live in the openwdl/wdl-docs GitHub repository. Find WDL resources and documentation on the wdl-docs website.
This article includes instructions for running multiple versions of Java on the same computer (for example, if you're developing and testing WDLs on your laptop before running at scale on Terra, or running command-line tools with different version requirements).
if you're not using containers for GATK jobs running locally, Cromwell and GATK (and other tools) would use your local machine's default version of Java, but their requirements may not be compatible (depending on the version of Java on your local machine).
In order to run WDL scripts that include GATK tasks on the Cromwell execution engine, you will need to specify which version of Java to use without having to install and uninstall versions each time. Below is a solution that is reasonably painless.
Java version requirements GATK requires version 1.8 exactly, while Cromwell requires version 11. To be clear: GATK does not yet support 1.9, and older versions (1.6 and 1.7) no longer work.
For the most up-to-date information, see What are the requirements for running GATK?
Cromwell is developed, tested, and containerized using AdoptOpenJDK 11 HotSpot.
Why use Java Development Kit packages? 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.
1. First, check your current default java version by opening your terminal and typing the following.
2. Prepend calls to GATK within the command section of the WDL script.
Since you are running this command from within a WDL script using Cromwell, this means adding the below code in front of each call to GATK within the “command” section of the WDL script.
What to do
If the default version doesn't start with “1.8”, you will need to add the following code to each of the calls to a GATK tool to specify that it should be run using version 1.8.
/usr/libexec/java_home -v 1.8.0_79 --exec java -jar GenomeAnalysisTK.jar -T ...
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 the specific version of java installed on your machine, 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.
For more information on WDL script components, see the The Getting Started with WDLs user guide.