Please view the edits below
I\'m trying to create a JShell instance that gives me access to, and lets me interact with objects in the <
Now, there is better and easier solution:
package ur.pkg;
import jdk.jshell.JShell;
import jdk.jshell.execution.LocalExecutionControlProvider;
public class TestShell {
public static int testValue = 5;
public static void main(String[] args) {
JShell shell = JShell.builder().executionEngine(new LocalExecutionControlProvider(), null).build();
TestShell.testValue++;
System.out.println(TestShell.testValue);
shell.eval("ur.pkg.TestShell.testValue++;").forEach(p -> {
System.out.println(p.value());
});
System.out.println(TestShell.testValue);
}
}
Default execution engine is JDI, but u can switch it to local or own.