2

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.

JachobTailor
  • 107
  • 11

1 Answers1

2

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");
JachobTailor
  • 107
  • 11
  • In my case running Intellij in a macbook: Scene.v().setSootClassPath("target/classes:/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre/lib/jce.jar:."); – João Matos Dec 02 '19 at 21:25