XUtils

JLine

Includes features from modern shells like completion or history.


Documentation

Forums

JANSI

The JANSI project has been merged into JLine. The following artifacts are available:

  • jansi-core: the fine-grained jar containing jansi
  • jansi: a jar bundle which contains jansi-core and the needed jline dependencies

FFM vs JNI vs Jansi vs JNA vs Exec

To perform the required operations, JLine needs to interoperate with the OS layer.
This is done through the JLine TerminalProvider interface. The terminal builder will automatically select a provider amongst the ones that are available.

On the Windows platform, relying on native calls is mandatory, so you need to have a real provider (jline-terminal-xxx jar) registered and its dependencies available (usually the Jansi or JNA library). Failing to do so will create a dumb terminal with no advanced capabilities.

By default, the following order will be used.

JNI

Since JLine 3.24.0, JLine provides its own JNI based provider and native libraries. This is the best default choice, with no additional dependency. One requirement is that JLine will load a native library: this is usually not a problem, but it could be a limitation in certain environments.

Building

Requirements

  • Maven 3.9.7+
  • Java 8+ at runtime
  • Java 22+ at build time
  • Graal 23.1+ (native-image)

Check out and build:

git clone git://github.com/jline/jline3.git
cd jline3
./build rebuild

Build Graal native-image demo:

./build rebuild -Pnative-image

Results

The following artifacts are build:

The big bundle includes everything (except jline-groovy) and is located at:

jline/target/jline-${jline.version}.jar

The jansi bundle is located at:

jansi/target/jansi-${jline.version}.jar

The fine grained bundles are located at:

terminal/target/jline-terminal-${jline.version}.jar
terminal-jansi/target/jline-jansi-${jline.version}.jar
terminal-jna/target/jline-jna-${jline.version}.jar
reader/target/jline-reader-${jline.version}.jar
style/target/jline-style-${jline.version}.jar
remote-telnet/target/jline-remote-telnet-${jline.version}.jar
remote-ssh/target/jline-remote-ssh-${jline.version}.jar
builtins/target/jline-builtins-${jline.version}.jar
console/target/jline-console-${jline.version}.jar
groovy/target/jline-groovy-${jline.version}.jar
jansi-core/target/jansi-core-${jline.version}.jar

Maven has a concept of SNAPSHOT. During development, the jline version will always end with -SNAPSHOT, which means that the version is in development and not a release.

Note that all those artifacts are also installed in the local maven repository, so you will usually find them in the following folder: ~/.m2/repository/org/jline/.

Running the demo

To run the demo, simply use one of the following commands after having build JLine

# Gogo terminal
./build demo

# Groovy REPL
./build repl

# Graal native-image
./build graal

Continuous Integration


Articles

  • coming soon...