sruthi ganesh
sruthi ganesh

Reputation: 31

Failed to load java.lang.CharSequence error

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);
  }
}

Upvotes: 1

Views: 1060

Answers (2)

samar1tan
samar1tan

Reputation: 21

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

Upvotes: 2

Alyssandra
Alyssandra

Reputation: 106

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.

Upvotes: 0

Related Questions