public static void main ( String [ ] args ) throws Exception { String loopBack = null ; Socket socket = new Socket ( loopBack , Integer . parseInt ( args [ 0 ] ) ) ; InputStream inStream = socket . getInputStream ( ) ; OutputStream outStream = socket . getOutputStream ( ) ; Map < String , Consumer < OutputStream > > outputs = new HashMap <> ( ) ; outputs . put ( "out" , st -> System . setOut ( new PrintStream ( st , true ) ) ) ; outputs . put ( "err" , st -> System . setErr ( new PrintStream ( st , true ) ) ) ; Map < String , Consumer < InputStream > > input = new HashMap <> ( ) ; input . put ( "in" , System :: setIn ) ; forwardExecutionControlAndIO ( new RemoteExecutionControl ( ) , inStream , outStream , outputs , input ) ; }
Launch the agent connecting to the JShell - core over the socket specified in the command - line argument .