0

I tried to run this command using Java version 8 on windows.

java -cp soot.jar soot.Main -cp ".;C:\Program Files\Java\jre1.8.0_151\lib\rt.jar" Example_4

I keep getting: Exception in thread "main" java.lang.Error: Error: Failed to load java.lang.CharSequence. This happens only when I have lines like System.out.print as part of my source code. Otherwise it works fine.

Source code

package ExampleCodes;

public class Example_4
{
   public static void main(String[] args)
   {
     int a = 10;

     a++;

    if(a<10)
        a--;
    else
        a++;
    int b = a + a;
    System.out.println(a);
  }
}

2 Answers2

1

please use Soot to analyze *.class files directly (recommended, since java frontend of soot is outdated), or degrade your JDK to 7.

see also: https://github.com/soot-oss/soot/issues/896

samar1tan
  • 11
  • 2
0

In order to resolve the call to System.out.println Soot needs to resolve all of the basic Java classes that it depends on, including CharSequence.

You can use the -pp option instead of passing your rt.jar in the -cp. Soot will then automatically retrieve rt.jar from the Java installation on your machine.

Alyssandra
  • 106
  • 1
  • 6