Search code examples
javajava-home

Could not load classfile


I am getting the below runtime exception when I try to run a Java program

Exception in thread "main" java.lang.RuntimeException: Could not load    classfile: java.util.concurrent.ConcurrentMap
at soot.coffi.Util.resolveFromClassFile(Util.java:75)
at soot.CoffiClassSource.resolve(CoffiClassSource.java:39)
at soot.SootResolver.bringToHierarchy(SootResolver.java:215)
at soot.SootResolver.bringToSignatures(SootResolver.java:239)
at soot.SootResolver.bringToBodies(SootResolver.java:280)
at soot.SootResolver.processResolveWorklist(SootResolver.java:150)
at soot.SootResolver.resolveClass(SootResolver.java:124)
at soot.Scene.tryLoadClass(Scene.java:417)
at soot.Scene.loadBasicClasses(Scene.java:990)
at soot.Scene.loadNecessaryClasses(Scene.java:1061)
at soot.Main.run(Main.java:167)
at soot.Main.main(Main.java:141)

The command used is

java -cp soot-csi.jar:../lib/soot-2.5.0.jar blah.soot.SomeClass

Since ConcurrentMap is one of the basic JRE classes, I was thinking that it is being caused by the rt.jar file not being able to be found/present in the jdk. So I checked my $JAVA_HOME variable and it does point to a JDK where the rt.jar resides inside the lib folder. So the structure is like this.

/usr/lib/jvm/java-1.7.0-openjdk.x86_64/lib/rt.jar
where $JAVA_HOME = /usr/lib/jvm/java-1.7.0-openjdk.x86_64

Anyone know how to solve this issue?


Solution

  • Try to use absolute path to java executable like

    $ /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/java -cp ...
    

    Probably a soley java executes an older version that do not include ConcurrentMap.