Need library for ANSI terminal output.

  • Thread starter Michel Pelletier
  • Start date
M

Michel Pelletier

Hello,

We need to write text-based (no GUI) Java applications that output to
ANSI terminals across a network, using telnet. Anybody know of a
library similar to AWT or SWING that offers window management, edit
controls and the like, for text-based applications?

Many thanks,

Michel Pelletier
 
T

Thomas Weidenfeller

Michel Pelletier said:
We need to write text-based (no GUI) Java applications that output to
ANSI terminals across a network, using telnet. Anybody know of a
library similar to AWT or SWING that offers window management, edit
controls and the like, for text-based applications?

There is no pure Java library at all for terminal I/O (one can't do the
necessary line control for terminals via the Reader/Writer/Stream
APIs).

There are some low-level libraries which e.g. wrap the Unix curses
API. Google for jcurses (several libs use this name) or javacurses.
One of these j*curses library (sorry, forgot whiche name), is suppossed
to also offer some higher-level "widgets". And there is charva, which
claims to be a drop-in replacement for AWT.

/Thomas
 
B

Brad BARCLAY

Thomas said:
There is no pure Java library at all for terminal I/O (one can't do the
necessary line control for terminals via the Reader/Writer/Stream
APIs).

If you're writing to an ANSI (or VT52/VT100/VT220/whatever) terminal
you should be able to do this by writing the correct line-control codes
to System.out. You'd have to put together the line control codes
yourself, and embed them into your output.

Mind you, I don't know of any library that currently implements this.

Brad BARCLAY
 
J

Jeffrey Palm

Michel said:
Hello,

We need to write text-based (no GUI) Java applications that output to
ANSI terminals across a network, using telnet. Anybody know of a
library similar to AWT or SWING that offers window management, edit
controls and the like, for text-based applications?

Many thanks,

Michel Pelletier

Try TUI:

http://www.bmsi.com/tuipeer/

Jeff
 
T

Thomas Weidenfeller

Brad BARCLAY said:
If you're writing to an ANSI (or VT52/VT100/VT220/whatever) terminal
you should be able to do this by writing the correct line-control codes
to System.out. You'd have to put together the line control codes
yourself, and embed them into your output.

It is not the terminal control which is the problem here. It is
controlling the communication line (if you still have a physical line
running to that one terminal), e.g. setting it to 9600 baud, 7bit, odd
parity, two stop bits, and controlling your OS', e.g. setting a
terminal driver to not map NL to CR (or to map it), or getting fill
characters over the line if you have delays. Or, to make sure
System.in/out don't buffer.
Mind you, I don't know of any library that currently implements this.

A long time ago I started writing a pure Java library for terminal I/O
(using the old termcap format for terminal capability descriptions),
but gave up due to the lack of control one has over System.out, or any
other Reader/Writer/Stream. There was, e.g. no way to guarantee the
delays some real terminals need after they e.g. get a backspace or CR.
There was no way to ensure System.in/out are unbuffered, etc.

I am convinced that one needs JNI, or a library using JNI, to do any
kind of useful non trivial terminal I/O in Java.

/Thomas
 
R

Roald Ribe

Thomas Weidenfeller said:
It is not the terminal control which is the problem here. It is
controlling the communication line (if you still have a physical line
running to that one terminal), e.g. setting it to 9600 baud, 7bit, odd
parity, two stop bits, and controlling your OS', e.g. setting a
terminal driver to not map NL to CR (or to map it), or getting fill
characters over the line if you have delays. Or, to make sure
System.in/out don't buffer.


A long time ago I started writing a pure Java library for terminal I/O
(using the old termcap format for terminal capability descriptions),
but gave up due to the lack of control one has over System.out, or any
other Reader/Writer/Stream. There was, e.g. no way to guarantee the
delays some real terminals need after they e.g. get a backspace or CR.
There was no way to ensure System.in/out are unbuffered, etc.

I am convinced that one needs JNI, or a library using JNI, to do any
kind of useful non trivial terminal I/O in Java.

The original poster asked about telnet. No serial port involved.

I am interested to know if you used the optional javax.comm pack
http://java.sun.com/products/javacomm/ for your experiments?
I would be surprised if the wanted functionality you describe
above is not possible with it. But since I have never tested it,
it could be correct that it is not of course.

Roald
 
T

Thomas Weidenfeller

Roald Ribe said:
The original poster asked about telnet. No serial port involved.

Yes, but similar problems. E.g. one needs to make sure telnet is
running in character-by-character mode, and that the bunch of control
characters telnet usually interprets are passed through transparently.
I didn't see a way to control this if all one has is a
Reader/Writer/Stream.
I am interested to know if you used the optional javax.comm pack
http://java.sun.com/products/javacomm/ for your experiments?

I know about it, but it wasn't going to fix my primary problem. What is
a terminal library good for that can write to the serial lines only,
but not to the system console?


/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top