This is a test version of Biostars. For the public version, visit https://www.biostars.org.
NoClassDefFoundError: htsjdk/samtools/util/IntervalTree

When I run circm6A (https://github.com/canceromics/circm6a) example code:

cd ../..
java -Xmx16g -jar circm6a.jar -ip test_data/HeLa_eluate_rep_1.chr22.bam -input test_data/HeLa_input_rep_1.chr22.bam -r test_data/gencode_chr22.gtf -g test_data/hg38_chr22.fa -o test_data/example_Hela

The following error occurred:

`Start at 2021-12-12 16:33:26
Exception in thread "main" java.lang.NoClassDefFoundError: htsjdk/samtools/util/IntervalTree
    at main.Method.loadGenes(Method.java:200)
    at main.Method.run(Method.java:66)
    at main.Main.main(Main.java:9)
Caused by: java.lang.ClassNotFoundException: htsjdk.samtools.util.IntervalTree
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 3 more`

I have check my java version:

openjdk version "1.8.0_292" OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10) OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

The samtools and htsjdk have been sucessfully installed.

I don't know how to solve "NoClassDefFoundError: htsjdk/samtools/util/IntervalTree"

Many thanks.

noclassdeffounderror

1 answer

IMHO something's missing in the documentation.

get the required libraries: htsjdk-2.10.1.jar (https://repo1.maven.org/maven2/com/github/samtools/htsjdk/2.10.1/htsjdk-2.10.1.jar) commons-math3-3.6.1.jar (https://repo1.maven.org/maven2/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar )

and then run

java -Xmx16g -cp /path/to/commons-math3-3.6.1.jar:/path/to/htsjdk-2.10.1.jar:/path/to/circm6a.jar  main.Main -ip test_data/HeLa_eluate_rep_1.chr22.bam -input test_data/HeLa_input_rep_1.chr22.bam -r test_data/gencode_chr22.gtf -g test_data/hg38_chr22.fa -o test_data/example_Hela

Thanks for your comment. I found that the error occurred even in the installation process.

https://github.com/canceromics/circm6a

When I run the installation process:

git clone https://github.com/canceromics/circm6a

cd circm6a/huntcircRNA/src

javac -d ./ -classpath ./lib/* ./main/*.java ./genome/*.java ./mapping/*.java ./output/*.java

The following error occurred.

javac: invalid flag: ./lib/htsjdk-2.10.1.jar

Both htsjdk-2.10.1.jar and commons-math3-3.6.1.jar were found in lib.

I don't know why this error occurred, and I have updated the two files with the links you provided.

Your code works!. Thanks a lot.

I runned the installation like this:

git clone https://github.com/canceromics/circm6a

cd circm6a/huntcircRNA/src

jar -cvmf META-INF/MANIFEST.MF ../../circm6a.jar *

Then I runned the following code:

java -Xmx16g -cp ./huntcircRNA/src/lib/commons-math3-3.6.1.jar:./huntcircRNA/src/lib/htsjdk-2.10.1.jar:./circm6a.jar main.Main -ip test_data/HeLa_eluate_rep_1.chr22.bam -input test_data/HeLa_input_rep_1.chr22.bam -r test_data/gencode_chr22.gtf -g test_data/hg38_chr22.fa -o test_data/example_Hela

It works now.

Many thanks.

Log in to answer this question.