Invalid or corrupt jarfile

GreyGrey Member
edited January 23 in Ask the GATK team

When I run

./gatk --help

it seems to be working fine. However, running anything else such as

./gatk --list

produces an error:

Error: Invalid or corrupt jarfile /path/to/gatk/gatk-4.0.0.0/gatk-package-4.0.0.0-local.jar

What's going on? Sorry this might be noob question.

Answers

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    Can you try to re-download the package and extract the script and the jar files into the same folder? Your download may have been interrupted therefore the file is corrupt.

  • lbotiguelbotigue Member

    Hi, I got the same error and realized I was working with java 1.7, whereas java 1.8 is required.

  • preetisinghpreetisingh Member

    Hi,

    I have java 1.8 and i still get this error
    GATK jar /Users/preetisingh/Documents/gatk-4.0.1.1/gatk-package-4.0.1.1-local.jar
    Running:
    java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=1 -jar /Users/preetisingh/Documents/gatk-4.0.1.1/gatk-package-4.0.1.1-local.jar --help
    Invalid or corrupt jarfile /Users/preetisingh/Documents/gatk-4.0.1.1/gatk-package-4.0.1.1-local.jar

    The terminal doesn't recognise GATK as commands. I reinstalled the package and still no avail (tried this at least 5 times). Could someone please help me.

    I'm new to GATK and have had my brain wrecked over this since last 2 weeks. Any help is much appreciated.

    Many thanks.

    Regards,

    Preeti

  • preetisinghpreetisingh Member

    Also, the script and jar files have been extracted into the same folder (every time) and still I get the same error.

    Thanks.

    Preeti

  • preetisinghpreetisingh Member

    Hi,

    Apologies for the constant texts. I have been able to list the files but my terminal (on Mac) still doesn't recognise GATK commands. With any GATK command I get the following error
    -bash: gatk: command not found

    I am unable to create a reference file even though I have downloaded the bundle from Broad institute ftp server. Any GATK command comes with the above mentioned error.

    ./gatk works with --help and --list but nothing else.

    Hope someone will be able to address my concerns.

    Many thanks.

    Regards,

    Preeti

  • Hi,

    I am currently having the same issue. I ensured I had the correct java version (1.8) and I downloaded directly from the GATK website. So far, ./gatk --help works but ./gatk list or any other command doesn't work.

    I have gotten the following errors:
    "-bash: ./gatk: No such file or directory"
    or
    " Error: Invalid or corrupt jarfile".

  • Hi,
    I also have same problem. My system is Linux, and java is "java version "1.8.0_45". I download the gatk-4.0.1.2.zip and unzip it, then I run ./gatk --list
    ./gatk --list
    Using GATK jar /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar
    Running:
    java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=1 -jar /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar --help
    Error: Invalid or corrupt jarfile /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar

    Please help me, how can I solve it?

  • SheilaSheila Broad InstituteMember, Broadie, Moderator admin

    @preetisingh @JmeAlena @zhaoxvwahaha
    Hi everyone,

    Do you have Python 2.6 or greater installed as well? Have a look at the README for more information.

    -Sheila

  • Hi there,

    My version of python is 2.7.7.

  • SheilaSheila Broad InstituteMember, Broadie, Moderator admin

    @JmeAlena
    Hi again,

    The README did not help? Can you post exactly what you get when you type python --version and java -version in your command line? Sometimes you may have a few different versions downloaded and the version used is not the one you want.

    -Sheila

  • It appears that the cluster I was using had some issues with the java version 1.8 even though it was the version being used. I have moved a different cluster that seems to have java properly installed and it now works. Thank you!

  • lindenblindenb FranceMember ✭✭

    Hi had the same problem today: multiple java JVM installed on our server. I quickly fixed it by changing the gatk script.

    def formatLocalJarCommand(localJar):
        return ["java"] + PACKAGED_LOCAL$
    
    

    to

    def formatLocalJarCommand(localJar):
        return ["/full/path/to/java"] + PACKAGED_LOCAL$
    
  • zhangnewzhangnew Member

    @lindenb said:
    Hi had the same problem today: multiple java JVM installed on our server. I quickly fixed it by changing the gatk script.

    def formatLocalJarCommand(localJar):
        return ["java"] + PACKAGED_LOCAL$
    
    

    to

    def formatLocalJarCommand(localJar):
        return ["/full/path/to/java"] + PACKAGED_LOCAL$
    

    Thank you for fixed my problem.

  • shleeshlee CambridgeMember, Broadie, Moderator admin

    Thanks for sharing your solution @lindenb.

  • If you are using a conda env (like me), you can simply resolve installing java inside the conda env, like this:

    source activate gatk
    conda install -c cyclus java-jdk
    

    I think it should already be present in the gatkcondaenv.yml file if java v1.8 is one of the requirements!

  • embemb Member

    I'm running into this same error, but I can't seem to use any of the provided solutions to fix it. I'm on java 8.45 and python 3.6.2:

    java -version
    java version "1.8.0_45"
    Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
    
    python --version
    Python 3.6.2 :: Continuum Analytics, Inc.
    

    System info:

    lsb_release -a
    LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
    Distributor ID: CentOS
    Description:    CentOS release 6.5 (Final)
    Release:        6.5
    Codename:       Final
    

    I tried hard coding the java path like lindenb suggested, but that didn't work. I also hard coded the python path in the shebang. Prior to doing that, I download and unzipped the file three times and still received the same error.

    ./gatk --help
    

    The output is as expected:

    Usage template for all tools (uses --spark-runner LOCAL when used with a Spark tool)
        gatk AnyTool toolArgs
    
     Usage template for Spark tools (will NOT work on non-Spark tools)
        gatk SparkTool toolArgs  [ -- --spark-runner <LOCAL | SPARK | GCS> sparkArgs ]
    
     Getting help
        gatk --list       Print the list of available tools
    
        gatk Tool --help  Print help on a particular tool
    --cutoff remainder of output
    

    But when I try to call gatk, I get the previously mentioned error:

     java  -jar ./gatk \
                -T SplitNCigarReads \
                -R /path/to/fasta \
                -I /path/to/input \
                -o /path/to/output \
                -rf ReassignOneMappingQuality \
                -RMQF 255 \
                -RMQT 60 \
                -U ALLOW_N_CIGAR_READS
    
    Error: Invalid or corrupt jarfile ./gatk
    
    pwd
    /emb/software/gatk-4.0.11.0
    

    I even created a gatk env (followed README instructions) and tried running the command within the session, but I still get the same error.

    Thanks for any insight.

  • shleeshlee CambridgeMember, Broadie, Moderator admin

    Hi @emb,

    In GATK4, the ./gatk is a launch script and not a jar. Instead of java -jar ./gatk, try just invoking the toolkit with ./gatk. Alternatively, using the Docker image solves all install and dependency setups. Instructions to set up Docker are in Tutorial#11090.

Sign In or Register to comment.