How to run a java application with jshell? It should be able to specify classpath and call java command and pass some arguments like bash does,e.g,
#!/bin/bash
$ARGS=...
$CLASSPATH=...
java -cp $CLASSPATH $ARGS com.example.MyApp
Update:
I think a wrapper of Runtime or Process is required, e.g.,
jshell> private String executeCommand(String command) {
   ...>
   ...>         StringBuffer output = new StringBuffer();
   ...>
   ...>         Process p;
   ...>         try {
   ...>             p = Runtime.getRuntime().exec(command);
   ...>             p.waitFor();
   ...>             BufferedReader reader =
   ...>                             new BufferedReader(new InputStreamReader(p.getInputStream()));
   ...>
   ...>                         String line = "";
   ...>             while ((line = reader.readLine())!= null) {
   ...>                 output.append(line + "\n");
   ...>             }
   ...>
   ...>         } catch (Exception e) {
   ...>             e.printStackTrace();
   ...>         }
   ...>
   ...>         return output.toString();
   ...>
   ...>     }
|  Created method executeCommand(String)
jshell> String out =executeCommand("java --version");
out ==> "java 9.0.4\nJava(TM) SE Runtime Environment (bui ... d 9.0.4+11, mixed mode)\n"
jshell> System.out.println(out);
java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)