# Run the Console Application Using TerrJavaRemote

This topic shows example user input and text output when running the TerrJavaRemoteConsoleExample application on Linux.

This example includes the same input as the example from Run the console application, demonstrating that it is possible to do everything in the spawned TERR engine that was possible using the embedded engine, including calling readline to read a line from the console (which is returned to the spawned TERR process).

    seaqal6406 TerrJavaRemoteConsoleExample% /opt2/users/jdoe/jdk1.7.0_40/bin/java -classpath .:/opt2/users/jdoe/TERR.rev17575.lnx64.intel.release/library/terrJava/java/terrJava.jar TerrJavaRemoteConsoleExample /opt2/users/jdoe/TERR.rev17575.lnx64.intel.release /opt2/users/jdoe/jdk1.7.0_40
    TerrJavaRemoteConsoleExample:
    started engine node pid==24125 at Thu Jun 12 16:08:00 2014
    > # simple comments do nothing
    > 1:10
     [1]  1  2  3  4  5  6  7  8  9 10
    >
    > # terrJava is automatically loaded,
    > # so you can call .JavaMethod
    > .JavaMethod("java/lang/Math", "pow", "(DD)D", 2, 3)
    [1] 8
    >
    > # call readline, which calls input handler
    > # to read a line
    > x <- readline()
    typing in a new line
    > x
    [1] "typing in a new line"
    >
    > # change prompt string, then change it back
    > options(prompt="newprompt--> ")
    newprompt--> 1+2
    [1] 3
    newprompt--> options(prompt="> ")
    >
    > # handle incomplete expression
    > # by accumulating multiple lines
    > 1+(2
    + +3)
    [1] 6
    >
    > # handle incomplete string
    > # by accumulating multiple lines
    > nchar("abcd
    Continue string: efg")
    [1] 8
    >
    > # error is printed out
    > stop("foo")
    Error: foo
    > # traceback() gives stack from last error
    > traceback()
    1: stop("foo")
    >
    > # quit from engine
    > q()
    seaqal6406 TerrJavaRemoteConsoleExample%