Sche2021
Sche2021

Reputation: 21

#error running igv **Error: A JNI error has occurred, please check your installation and try again

I already looked in previous questions since it appears that my issue is quite common. However I still cannot solve this problem. When I run the IGV program I got this error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/broad/igv/ui/Main 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:763)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

I checked java versions:

java -version
openjdk version "1.8.0_152-release"    
OpenJDK Runtime Environment (build 1.8.0_152-release-1056-b12)    
OpenJDK 64-Bit Server VM (build 25.152-b12, mixed mode)    

javac -version
javac 1.8.0_152-release    

which java    
/home/sche/anaconda2/bin/java

If I understand correctly I needed to install a uptdated version of java (e.g. 11): so I tried:

sudo apt update    
sudo apt install openjdk-11-jdk 

however, still there is the old version

 java -version
openjdk version "1.8.0_152-release"    
OpenJDK Runtime Environment (build 1.8.0_152-release-1056-b12)     
OpenJDK 64-Bit Server VM (build 25.152-b12, mixed mode)

javac -version    
javac 1.8.0_152-release    

I also tried manually with:

curl -O https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz    
tar zxvf openjdk-11.0.2_linux-x64_bin.tar.gz    
sudo mv jdk-11* /usr/local/    
sudo vim /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin

I really don't understand how to solve this issue thanks for your help

Upvotes: 1

Views: 7884

Answers (2)

Nereus
Nereus

Reputation: 361

I had the same problem and resolved it by specifying the version of Java that should be used by IGV (v11, not v1.8). You'll have to locate your Java 11 installation first.

export JAVA_HOME="/path/to/openjdk-11.0.13-h87a67e3_0"
export PATH=$JAVA_HOME/bin:$PATH
igv

This code was saved as runigv.sh. To run IGV:

bash runigv.sh

It's a bit of a workaround, so maybe there are more elegant solutions.

Upvotes: 0

Sche2021
Sche2021

Reputation: 21

solved it with

set JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/"
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/"
export PATH=$JAVA_HOME/bin:$PATH

Upvotes: 1

Related Questions