CHARVA vs Lanterna – Comparing user-interface functionality for Java

Let’s say you want to program a game with a low level user interface (for example Pacman). But you don’t want to invest much time in the user-interface. So you take a look at existing libraries/frameworks providing user-interface functionality. The most popular ones are CHARVA [1] and Lanterna [2]. But which one is better?

Lanterna vs CHARVA – Structure

CHARVA is a Java framework presenting “graphical” user interface. It can be structured in two components [1]:

  1. Library of Java classes implementing serval “graphical widgets” (for example buttons, windows …)
  2. Dynamically-loaded shared library (written in C).

Lanterna on the other hand is a Java library which enables easy semi-graphical user interfaces. It is composed of 3 layers which are all written in Java [2]:

  1. Low level terminal interface (googlecode.lanterna.terminal): Provides most basic control of the terminal text area like moving cursor/ putting characters to screen
  2. Full screen buffer (googlecode.lanterna.screen):  Layer to put on top of a Terminal object. Allows you to write to this before flushing the changes to the actual terminal.
  3. Full GUI toolkit (googlecode.lanterna.gui): Provides windows, buttons, labels and other components

Lanterna vs CHARVA – Differences/Similarities

They both work with Swing and provide Maven dependencies, which makes them easy to use. The documentation in Lanterna and CHARVA isn’t great,  but Lanterna provides a slightly better documentation. Furthermore instead of using the Maven dependency you can also just add the Lanterna jar file. Therefore there is no need for any prerequisites when using Lanterna. CHARVA however expects you to have Apache Ant installed [3, 4].


CHARVA Lanterna
Documentation okay okay
Uses Swing Yes Yes
Maven <dependency>










Prerequesits Apache Ant
Functionality compared to curses Uses ncurses Provides more functionality
Pure Java No Yes (independent of any native library)

Figure 1  differences/similarities between CHARVA and Lanterna


But what about the functionality? Curses is a popular example for a terminal control library enabling the construction of text user interface applications [5]. Ncurses (new curses) is a “free-software emulation (clone) of the System V Release 4.0 (SVr4) curses“[6]. CHARVA uses ncurses. Lanterna is similar to curses but provides more functionality [2]. But Laterna provides semi-graphical support whereas ncurses enables graphical support too [7].

Lanterna is the better choice regarding text and semi-graphical user interface functionality. But if you are searching for graphical user interface functionality choose CHARVA.











Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s