"Linux Gazette...making Linux just a little more fun!"

The Answer Guy

By James T. Dennis, tag@lists.linuxgazette.net
Starshine Technical Services, http://www.starshine.org/

(?)Tools for converting X output to java

From Sheldon E. Newhouse on Tue, 31 Mar 1998 on the [linuxprog] mailing list

Are there any tools available to convert standard C code with X displays to java displays? Basically, we have a long program which is written in C and does low level X output. We would like to port it so that the number crunching part works on a back-end server and users can view output on java clients. The part of the program that does the display is fairly short, but intimately connected with the X libraires. Any ideas or references would be appreciated.


(!)I'm not sure about a "Java X Server" per se. However there has been some work done on execution of remote X applications through a web browser interface.

I have yet to use any of this stuff (I barely use X) --- so I can only rely on hearsay and a bit of web searching.

The first technology to consider is the latest release of X Windows itself. There was an initiative by the X Consortium (*) called "Broadway" --- this eventually became the widely accepted code name (possibly widely excepted as well -- but we won't get into that) for the entire X11R6.3 release.

Since I don't know most of the details it's probably best for me to just refer you to some online articles that discuss it:
Broadway/Xweb FAQ
Can X Survive on the Internet? By Brad Weinert
X Is Dead, Long Live X

Note that the constraint of this approach is that it seems to require that you actually have an X Server on the clients. This is great if you have just about any sort of Linux/Unix clients --- but may be prohibitive if you intend for Windows (NT, '95, or 3.x) or MacOS clients to access your applications.

You might be able to deploy the MI/X server (a freely available X Server for Windows and MacOS) but I don't know if it supports the X11R6.x "Broadway" features. You can find out more about MI/X at http://tnt.microimages.com/freestuf/mix/ and read MicroImages Inc.'s FAQ at http://tnt.microimages.com/freestuf/mix/mix-faq.htm.

A quick perusal of that suggests that it won't support the Broadway set of extensions (since the FAQ says that it doesn't support LBX -- the "low bandwidth X" which is apparently a key part of Broadway).

I don't know what commercial X Servers for Windows or the Mac will help --- but I needn't spend any more space on that issue since I you don't specify that as a requirement. Hummingbird's Exceed (http://www.unipres.com/hbird/exceed/) is a likely candidate.

Another approach might be to provide your clients with VNC --- which was listed in Linux Weekly News (http://www.eklektix.com/lwn/) a few weeks ago. This has nothing to do with Java and almost nothing to do with X Windows. However it does allow you to view X Windows displays from Windows and Mac clients and vice versa --- using an alternative to the X communications protocols.

The potential advantage is that it sounds much easier to install and configure than a Windows or MacOS X server. Take a look at at the "Olivetti and Oracle Research Laboratories" (http://www.orl.co.uk/vnc/) for more on that. Another advantage of this over MI/X would be that it is open source available under the GPL --- MI/X is free to use but the sources are not available.

The two approaches that are more directly suggested by your question are:
An Xlib to Java awt cross compiler (or class or library)

... or:
An X Server for the Java virtual machine (a class that implements Xlib).

I suspect that both of these are feasible --- though the performance costs of the latter may not make it palatable and I'm sure that the portability issues in each would be significant.

Despite my search engine efforts I was unable to find any information on any work being done on either approach. However, I'm not an expert in Java and I don't keep up on it much. So, maybe someone else here will help us out.

I did look in several likely places at http://www.developer.com/directories/ (formerly the Gamelan archives). The closest I found is a JXTerm --- allegedly an 'xterm' in Java. This includes telnet and cut and paste features. There are several Java terminal emulators including VT100, VT220, ANSI-BBS, TN3270 and TN5250 applets.

Meanwhile I've been hearing snippets of SCO's (http://www.sco.com/) "Tarantella" for the last year or so. This apparently does act as an X Windows to Java gateway, providing a sort of "web desktop" or "webtop" as their marketing copy refers to it. It appears that you'd have to install a SCO OpenServer system to either run your application or to act as a gateway between your applications server and your clients. (I doubt sincerely that SCO will make Tarantella available for Linux --- and it doesn't seem to be written in Java). I'm really curious as to how this works.

(While I was writing this I installed a new copy of the Netscape RPM from my Red Hat CD -- this is a new system that I just built from parts, it's running S.u.S.E. -- started an X session, started Navigator, pointed my browswer at http://tarantella.sco.com/ and tried to access their demo. It gets to some point before showing my anything like X or it's "webtop" with some complaint about a Java Security violation in some class or another. Exiting and retrying got me further along. Hint: don't try 'Tarantella' during your first Navigator session. Eventually I was able to get it running ...err... walking ...err... limping along. It might be faster over a T1 or an ethernet -- I happen to be using the 28.8 PPP connection at the moment).

If you're curious, go try the demo yourself. You can also find a set of slides from a presentation by Andy Bovington (?) on:
Controlling X/Motif apps from Java and Javascript.

In typical "big company" fashion SCO doesn't tell you how much this product costs. They expect you to fill out a survey and have their sales critters call you.

I suspect that this circumlocution may result in more converts to open source software than all of the other "freedom" arguments we can muster.

Meanwhile, my wife, Heather, found a couple of promising links (she's the real search engine wiz in the family).

Here's the most promising:
Eugene O'Neil's XTC, the X Tool Collection

... which appears to be at the early alpha stages but, in his own words:
... is an implementation of the X Window Protocol, written in pure Java. It does not require any native C libraries, such as Xlib: instead, it is intended as a complete replacement for Xlib, written from the ground up to be flexible, object-oriented, and multi-threaded.


There was also some work done by a Mr. Igor Boukanov at:
Pure Java X client

By far the best technical information I found on X Windows in my search was:
Kenton Lee's: Technical X Window System and Motif WWW Sites

Kenton has the best set of links on the subject, and apparently has written articles for 'X Advisor Magazine' and several others.

Copyright © 1998, James T. Dennis
Published in Linux Gazette Issue 28 May 1998

[ Table Of Contents ] [ Front Page ] [ Answer Guy Index ]