We've moved!
This site is now read-only. You can find our new documentation site and support forum for posting questions here.
Be sure to read our welcome blog!

java conflict on cluster

BlueBlue Member
edited June 2013 in Ask the GATK team


I'm getting repeated errors relating to java, when using GATK in a shell script on my university cluster. The message is 'NoClassDefFoundError'. It has worked previously using GATK version 2.1.9 (on a different node). My memory allocation for GATK on the cluster is set to 16GB. As I'm using GATK as part of a shell script which invokes java, then the 'java', '-2xmg' and '.jar' parts of the command are not required (at least they weren't previously). Attempting to invoke GATK from the command line in cluster using -bash: /cm/shared/apps/GenomeAnalysisTK/2.1.9/GenomeAnalysisTK.jar ...returns :Permission denied

The first question is 'am I coding it correctly?', the second is 'could GATK not be happy with java?' and the third is 'do you have any tips to resolve this?'

I have read the several of the answers relating to java-GATK problems but am none the wiser. Any help would be most appreciated.



The shell script commands are:

#$ -N ReadMapper_H001
#$ -S /bin/sh 
    # Reference file IO (.e and .o files) to the current working directory 
#$ -cwd 
#Merge the standard out and standard error to one file 
#$ -j y 
#Use the bioinf.q 
#$ -q bioinf.q 
. /etc/profile.d/modules.sh 

# Load modules 
module load bio/1.15 gatk/2.4.9 jdk/1.6.0_24 picard-tools/1.77 R/2.14.0

# All the other stuff (scythe, sickle, bwa, picard etc for cleaning, read mapping etc)

# Identify indels from reference genome
GenomeAnalysisTK \
    -I /mnt/lustre/scratch/bioenv/wg39/tmp/lhm_read_mapping/H001/H001_CRSN.bam \
    -R /home/w/wg/wg39/accessory_data_130613/Dmel_ref_seqs_051112/dmel-all-chromosome-r5.9.fasta \
    -T RealignerTargetCreator \
    -o /mnt/lustre/scratch/bioenv/wg39/tmp/lhm_read_mapping/H001/H001_realignment.intervals \

The error message is:

Exception in thread "main" java.lang.NoClassDefFoundError: java
Caused by: java.lang.ClassNotFoundException: java
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: java.  Program will exit.
Post edited by Geraldine_VdAuwera on

Best Answer


  • BlueBlue Member

    PS Apologies for the weird font in the above message.

  • WimSWimS Member ✭✭

    Are you running the latest version of GATK (2.6.3)? If so make sure that all your nodes run java 7. Execute java -version on all nodes to see the version. The output of that should be :

    java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

  • BlueBlue Member

    Hi Wim,

    Thanks for your response. I've been running GATK 2.4.9 and Java 1.6_24-b07. I'm specifying which version of Java to use, at the beginning of the shell script. The reason for this was that even if the default cluster version of Java changes as I sequence more samples, the version for the analysis pipeline remains constant. In reality this might not be so practical.

    I've tried running the script without specifying which Java version to use and the same error message is returned.

    I'm getting GATK 2.6.3 installed. I'll have to check with IT about the java version.

    So, I'm now assuming that the problem is caused by outdated version of Java.

    Cheers anyway, I'll post the outcome,


  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie admin

    Yes, starting with release 2.6 the GATK now requires Java 1.7. The announcement was delayed but will go out by noon today (EST). We'll also update all relevant documentation asap.

  • BlueBlue Member

    Having updated GATK and Java, my script was still failing at the GATK commands. Under the suspicion that this was caused by conflict with another Java-based program (probably an older version of Picard), I specified for program modules to be loaded and unloaded only at the relevant stages in the processing pipeline, and not to load all at the beginning of the script (for which they had previously worked before the updates). Anyway this works. I'm not sure if I'd have to separate out Picard and GATK loading and unloading if Picard was a recent version. Frequent upgrades are a pain in the terminal abdominal segment.

  • gokmenzgokmenz ShenzhenMember
    edited August 2013

    Hey Blue, did you solve the problem? I am also meeting with a similar problem in IndelRealigner part. I hava Java 1.7 and tried different versions of GATK but still hava problem.

    Here is my scripts:

    [email protected]:~/Desktop/Denemeler/GATK_VariantCalling/03.InDelRealignment$ java -Xmx1g –jar 01.bin/GenomeAnalysisTK.jar
    –T IndelRealigner
    –R ../00.RawData/reference.fa
    –I ../02.Mapping/sample1_RG.bam
    – ../00.RawData/Mills_and_1000G_gold_standard.indels.hg19.vcf
    – targetIntervals realigner.intervals
    –o realigned.bam

    Error: Could not find or load main class –jar

    Here is my Java version:

    Java 1.7 java version "1.7.0_25"
    Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie admin

    Are you by any chance building from source and then moving the jar to a different location? With the basic build target this won't work because it doesn't generate a full packaged jar. But we can give you instructions to do so if you need that.

    If you're using the precompiled binary then I have no idea what's going on.

  • mpw6mpw6 Member

    Hi, was this resolved? I'm having a similar problem:

    [[email protected] gatk]$ java /home/mpw6/GenomeAnalysisTK-2.7-2-g6bda569/GenomeAnalysisTK.jar -T RealignerTargetCreator -R human_g1k_v37.fasta -I F03-03.sorted.nodup.bam -known 1000G_phase1.indels.hg19.vcf -o F03-03.intervals.list

    Error: Could not find or load main class .home.mpw6.GenomeAnalysisTK-2.7-2-g6bda569.GenomeAnalysisTK.jar

    [[email protected] gatk]$ java -version

    java version "1.7.0_03"
    Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
    Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

    I downloaded the jar. It's not built from source.

  • mpw6mpw6 Member

    Never mind. I forgot the -jar flag.

Sign In or Register to comment.