Java 9 is introducing REPL called JShell inside the JDK distribution. Is there any way to connect into the JShell of the JDK that is running some application and execute commands referencing that running app. For example executing some methods form the apps code, inspecting objects, etc..?
JShell is not the standard java command, it's another command. Once you open the shell it "goes" in Read Eval Print Loop. Once you type a command it's read and parsed by the shell, evaluated and the result is printed.
You can define variables and add classes to the classpath, but I don't think is possible starting an application or a server from there, at least not at this stage and not in the same JVM. As you can add classes you can instantiate them, but you don't have an option to inspect their variables. However you can see the variables you instantiate in your JShell scope (what objects you created, you can access and print only their their public methods and variables).
It seems JShell will have an api, which opens the way for other possibilities.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With