Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread "main" java.lang.UnsupportedClassVersionError #501

Open
wangyuan1234 opened this issue Mar 10, 2022 · 10 comments
Open

Comments

@wangyuan1234
Copy link

when i train snippy using the data offered by author,
snippy --outdir mut1 --ref example.gbk --ctgs example.fna
I have the following problem:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/snpeff/SnpEff has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

I check my snippy version:snippy 4.6.0
java version:
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

I'm new to the command line, has anyone else had a similar problem, please help me

@sthifx
Copy link

sthifx commented Mar 10, 2022

Hi. Just to say that I've also received this error today. I know it used to work fine with snippy 4.6.0 using java 1.8.0_231, but not sure how to resolve it I'm afraid.

@wangyuan1234
Copy link
Author

I suspect that there is a problem with snpEff, so I found on the snpEff homepage that it requires a version of Java 12, I installed Java 12 and changed the environment variable to Java 12, but the problem still exists.
(snippy) zde 09:35:05 ~ $ export PATH=/home/zde/jdk-12.0.2/bin:$PATH
(snippy) zde 09:36:10 ~ $ java -version
java version "12.0.2" 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
(snippy) zde 09:36:21 ~ $ snpEff
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/snpeff/SnpEff has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

@HBrendy
Copy link

HBrendy commented Mar 17, 2022

snpEff=5 indeed requires Java 12 but does not seem to communicate this to conda. Pinning snpEff to the minimal required version for snippy does the trick for me:
mamba create -n snippy snippy=4.6 snpeff=4.3
One might test which version of snpEff is the highest compatible with snippy's requirement for openjdk=8.0.312 but for now, above solution is avoiding the issue.

@wangyuan1234
Copy link
Author

Thank you very much for your help, I solved this problem

@sekhwal
Copy link

sekhwal commented Mar 30, 2022

Hi,
I installed snippy using the following command but it is still showing an error. However, bcftools is installed with snippy in the conda env.

mamba create -n snippy snippy=4.6 snpeff=4.3
error-----
Need bcftools --version >= 1.7 but you have 0 - please upgrade it.

@apetkau
Copy link

apetkau commented Mar 30, 2022

Try version 5.0 of snpeff instead:

 mamba create --name snippy snippy snpeff==5.0

For using the latest version of snpEff it looks like Java 12 is not available in conda yet (the openjdk package only goes up to Java 11).

@sekhwal
Copy link

sekhwal commented Mar 30, 2022

Thank you for the suggestion.

After installing snippy using mamba it shows "bcftools not installed", but bcftools v1.15 is installed automatically by snippy.
mamba create --name snippy snippy snpeff==5.0

So, I did remove bcftools from the current conda environment.
conda remove bcftools (It will remove snippy also)

Then, reinstall snippy v4.6.0 with bcftools v1.10 in the current conda env.
Finally, it works.
snippy --check

Thanks again!

@zhichusun
Copy link

Hello, I would like to ask why the error is still displayed after I put snpeff=5.0

snpEff build -c reference/snpeff.config -dataDir . -gff3 ref
WARNING: All frames are zero! This seems rather odd, please check that 'frame' information in your 'genes' file is accurate.

bwa mem -Y -M -R '@rg\tID:mut1\tSM:mut1' -t 8 reference/ref.fa fake_reads.fq | samclip --max 10 --ref reference/ref.fa.fai | samtools sort -n -l 0 -T /tmp --threads 3 -m 2000M | samtools fixmate -m --threads 3 - - | samtools sort -l 0 -T /tmp --threads 3 -m 2000M | samtools markdup -T /tmp --threads 3 -r -s - - > snps.bam

[markdup] error reading header

Thank you very much for your help

@sekhwal
Copy link

sekhwal commented Apr 15, 2022

Hi, Did you figure out the issue?

@zhichusun
Copy link

I found that the default memory for the program to run is too large, and my virtual machine memory is not enough. The running code can be changed to this
snippy --cpu 1 --outdir mut1 --ref 1.gb --ctgs 1.fasta --ram 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants