# Implement a Console Using the TerrJava API

We have provided the example Java code in both Windows and Linux for a Java application that implements a simple TERR console using the TerrJava API. This is similar to the console application in `TerrJava.main`, except that it accesses the TerrJava methods from another class.

An interesting feature of this code is that the main `read-eval` loop detects when the current line cannot be evaluated because it is an incomplete expression or string, and it accumulates multiple lines until it does evaluate (or another type of error occurs). It also calls into TERR with `TerrJava.evaluateToString` to retrieve the appropriate prompt string for normal input, incomplete expression, or incomplete string, which can be changed in TERR at any time.