Skip to content

Commit 4df6f32

Browse files
committed
[readme] Add JShell description
1 parent e03aa18 commit 4df6f32

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ The output consists of these parts:
1313
* It has `javac` (jdk.compiler module).
1414
* JShell remote launcher (hackish, linux-only) is available.
1515

16+
## JShell hack
17+
We've managed to run JShell in a kind of "split-mode". The compiler part runs on your powerful computer,
18+
whether the not-so-demanding execution is done on the brick. This was almost supported out of the box -
19+
the default JShell configuration already uses JDI transport. The only issue is that it does not provide an
20+
intuitive way to connect to a remote host. JShell always launches a new JVM process in the JDI mode.
21+
22+
Our hack relies on replacing the agent in the VM started by JShell. The new dummy agent just
23+
writes the port number it was supposed to connect to a file `/tmp/jshellargs`. Then, if you make
24+
`jshellargs` a UNIX pipe, you can very easily pass the port to another application.
25+
26+
JShell on your computer is the listening side of the JDWP channel. To reuse the existing remote agent,
27+
which is used in the local JDI mode, we tunnel a chosen port over the SSH session. SSH connects to the
28+
JShell listening socket and itself listens on the remote side. Then, the last task is to run the
29+
JShell JDI agent on the remote side, which is handled by SSH as well.
30+
31+
Practically, first you have to either [add](https://askubuntu.com/a/4833) your pubkey to the EV3 brick's authorized_keys,
32+
or set the [SSH_ASKPASS](https://unix.stackexchange.com/a/83991) environment variable. Then, run a script from
33+
the amd64 JDK: `bin/jshell-launch.sh <ssh args>`, where `<ssh args>` is an address with an optinal port-specifying flag.
34+
The options are just added to the SSH command line and aren't sanitized in any way.
1635

1736
## Building
1837

0 commit comments

Comments
 (0)