Search code examples
javasoot

Receiving couldn't find class error even Setting Soot library classpath


I use soot for instrumenting a java program. I know for adding invocation to specific class in soot, we must set "Soot class-path" to the directory contains that class, .class file. So I do this in main method of main class. I bring the snippet of code bellow

public class Main {
public static void main(String[] args) {
Scene.v().setSootClassPath("/home/j/IdeaProjects/Test_1/classes:/home/j/IdeaProjects/Test_1/libs/rt.jar:home/j/IdeaProjects/Test_1/libs/jce.jar");
    PackManager.v().getPack("jtp").add(new Transform("jtp.RetIns", new ExIns()));
....

But when I want to use "Insop" class which resides in classes folder, by following code in Exins method:

static SootClass Ins;
static
{
    Ins= Scene.v().loadClassAndSupport("Insop");
}

I get the error

Caused by: java.lang.RuntimeException: couldn't find class: Insop (is your soot-class-path set properly?)

I should mention that I use ubuntu 14.4 32 bit and I run the code on intellij. I can not find what is my mistake. could you please help me.


Solution

  • I finally find the problem. I don't know why, but I should set "soot class-path" with relative path. For my project for example it should set as follow:

    Scene.v().setSootClassPath("classes:libs/rt.jar:libs/jce.jar");