I am playing with the JDK9's JShell API.
At present, the JShell API automatically launches the remote JVM internally. Instead of starting the process automatically, I want to separate the two process.
Note: I understand I can change the VM options. But I want to see if the VM can even be run on a different machine.
The default execution control eventually reaches this place in code.
If I specify launch, it automatically uses com.sun.jdi.CommandLineLaunch
connector, that actually launches the java program by definition.
If I specify no-launch, it uses com.sun.jdi.SocketListen
as I would expect, once it started the server socket, it automatically starts a remote vm and connects to this socket. This I think is unexpected.
Other things I tried,
Shell jshell = JShell.builder()
.executionEngine("jdi:hostname(localhost),launch(false)")
.build();
jshell.eval("1+2");
I would expect this to fail or be stuck until a separate process starts.
Is there an alternate way to specify the connectors, or not start a JVM? (I am not interested in 'local' either)
Some easy options like being able to specify com.sun.jdi.RawCommandLineLaunch
as the connector that accepts the custom command or being able to use the socket listen connector and wait for the other process to connect.