The jdomterm terminal emulator script

The jdomterm script is no longer recommended as a general terminal-emulator. It can be useful when using Java as it does not require native code.

By default it runs a shell (bash), but there are a number of options.

domterm [frontend] [backend-arguments]

The frontend argument specifies the front-end or user interface application - i.e. some kind of browser. The backend-arguments specify which command is run and how it is run.

Front-end (user interface) options

The frontend is one of the following:

--browser
--browser=program
--chrome
--firefox
--qtdomterm
--qtwebengine

Similar to the ldomterm options.

--javafx

This uses Java and the JavaFX WebView browser component (based on WebKit). It needs OpenJDK 1.8 (or JDK 7 with JavaFX) but should otherwise not need anything else. Instead of a WebSocket server, it uses JavaFX’s Java/JavaScript bridge.

The UI (written in Java using the JavaFX toolkit) is minimal, but right-clicking will bring up a popup menu. This supports copy and paste, as well as switching the input mode between line, character, or auto mode.

There are some glitches, and since JavaFX is not being actively developed, this port is not a priority.

--port portnum

Start a WebSocket server, listening on the specified portnum. (A portnum of 0 lets the system choose an available port, which is printed out. The default for repl-client.html is 8025.)

No front-end is started automatically. Instead, you load repl-client.html in your preferred web browser, and it connects to the server. If the server is listening on port portnum (rather than port 8025), browse to file:///path/to/DomTerm/repl-client.html?ws=//localhost:portnum.

This allows you to use "any" modern browser as the client. This is nice for development, as you can use the browser’s JavaScript console and debugger, DOM inspector, and so on. The browser talks to server using WebSockets, which modern browsers have built-in.

Back-end (command) options

The backend-arguments are one of:

[--pty|--pipe|-e] [command arg...]
--class classname arg...

You can specify some other command and arg in place of the default /bin/bash.

Specifically:

-e [command arg...]
--pty [command arg...]

This is the default on Unix-like systems (MacOs, GNU/Linux, BSD). It runs command under a PTY. Communication is by default character-by-character, but can also be line-based.

--pipe [command arg...]

The input/output of the command is connected to DomTerm using pipes. Data communication is normally on a line-by-line basis. (It is also possible to send single keystroke message.) The implementations uses a Java Process object. This should work on Windows, though it has not yet been tested.

--class classname arg...

This runs the main method of a specified Java class, but with the standard streams (input, output, and error) re-bound to a DomTerm window.

CLASSPATH=my-application.jar domterm --class my.ClassName arg...