Java widget for scripting with jshell. Requires Java 9 or later.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Java widget for scripting with jshell. Requires Java 9 or later, as it relies on the jshell executable in Java's bin directory.

The widget comes in form of a panel with two parts, the scripting part for your code (including syntax highlighting thanks to RSyntaxTextArea) and the output part, which will receive any output generated by jshell.

With this widget you can write Java code without having to compile it, jshell takes care of that.



You only have to place the JShellPanel in a frame or dialog and you can start scripting.

import javax.swing.JFrame;
import com.github.fracpete.jshell.JShellPanel;
JShellPanel panel = new JShellPanel();
JFrame frame = new JFrame("JShell");
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(panel, BorderLayout.CENTER);
frame.setSize(1200, 900);

It is also possible to listen to events in the widget, by supplying a com.github.fracpete.jshell.event.JShellListener object. The following code simply outputs the event type to stdout:

import com.github.fracpete.jshell.event.JShellEvent;
import com.github.fracpete.jshell.event.JShellListener;
import com.github.fracpete.jshell.JShellPanel;
JShellPanel panel = new JShellPanel();
panel.addJShellListener((JShellEvent e) -> System.out.println(e.getType()));


You don't have to use the widget in your own code, you can simply go ahead and do some scripting. Here is what you need to do:

  • download a release zip file and unzip it

  • place any additional jars that you want to use for coding in the lib directory

  • start up the user interface with the appropriate script:

    • Linux/OSX: bin/
    • Windows: bin\jshell.bat
  • start scripting



Add the following dependency to your pom.xml: