Virtual OS/2 International Consumer Education
VOICE Home Page: http://www.os2voice.org
October 2002

[Newsletter Index]
[Previous Page] [Next Page]
[Feature Index]

editor@os2voice.org


jetty:// - 100% Java Servlet programming under OS/2

By A. Nonymous © October 2002

Can you really do good Java programming work on OS/2 Warp and eComStation?

I've had great success doing so, yes. There's a very reasonable selection of GUI-based Java tools, editors, runtime environments, etc., all of which can help you build and host Java applications on your favorite operating system.

For example, Jetty is a 100% pure Java application that provides an HTTP server (supporting SSL), a Java servlet runtime environment, and support for JSPs (Java Server Pages). Jetty is open source, and the project homepage can be found here: http://jetty.mortbay.org

Why should you care? Well, the servlet API and JSPs provide the core components for industry-standard J2EE (Java 2 Enterprise Edition) application servers. (WebSphere Application Server is a J2EE application server, for example.) With Jetty, you can build sophisticated, interactive servlet-based web applications, all running on eComStation or OS/2 Warp.

Jetty is also the core of JBoss, a full, open source J2EE application server. (For more information on JBoss, visit http://www.jboss.org.) I haven't tested JBoss running on OS/2 Warp (yet), but it's likely that, since Jetty works, JBoss will as well.

OK, so how do you build your own Java servlets and run them with Jetty? First, pick up a good book on writing servlets, such as the one published by O'Reilly and Associates. Then, install the latest IBM Java Development Kit (JDK) you can find. (I'm using Version 1.3.1, July 2002 build.) That's the full development kit, not just the runtime, because JSPs depend on the JAVAC compiler.

Note that you can use older versions of Jetty with JDK 1.1.8, if you're so inclined, although I have not tested this combination. (You'll need to do a little digging to find the older version of Jetty that supports JDK 1.1.8, but it's still available and still perfectly viable.)

Go to the Jetty web site and download Jetty 4.0.5 (or whatever the latest is), or even the latest version 3.x (if you prefer something a little less bleeding edge). I've tested both, and they both work great.

You'll need to get the gzip and gtak (GNU tar) utilities from your favorite OS/2 Warp file library, such as Hobbes (http://ftp-os2.nmsu.edu). Those utilities will let you extract the files from the gzip'ed/tar'ed Jetty distribution.

Then, once you've got the files extracted, you've got a little fixup to do.

In Jetty 4.0.5, there are some long filenames that seem to get mangled by the OS/2 Warp gtak utility. Search for some files beginning with Compress:

DIR Compress* /S
There are five files that have their filenames truncated:
CompressionFilterTestServlet.class
CompressionFilterTestServlet.java
CompressionResponseStream.class
CompressionResponseStream.java
CompressionServletResponseWrapper.class
Rename your truncated files to these correct filenames.

Then, from a command line window, type in these commands (assuming you extracted the Jetty files to C:\Jetty-4.0.5 ):

SET JETTY_HOME=C:\Jetty-4.0.5

SET CLASSPATH=%JETTY_HOME%\lib\org.mortbay.jetty.jar;%JETTY_HOME%\lib\javax.servlet.jar;%JETTY_HOME%\lib\javax.xml.jaxp.jar;%JETTY_HOME%\lib\org.apache.jasper.jar;%JETTY_HOME%\lib\org.apache.crimson.jar;%JETTY_HOME%\lib\com.sun.net.ssl.jar;C:\JAVA131\lib\tools.jar;%CLASSPATH%

That CLASSPATH command is all on one line, and it assumes that you have Java 1.3.1 and that it's installed to C:\JAVA131. Change as appropriate for your situation.

Now, to run Jetty, type:

CD %JETTY_HOME%
java org.mortbay.jetty.Server etc\admin.xml etc\demo.xml
and to test your Jetty server for proper operation, open any web browser on the same system and access this web address: http://localhost:8080

If everything works, you should see the Jetty welcome page. And now you can start writing and running servlets and JSPs with the very latest APIs!

One little annoying thing: the console display (for Jetty's startup messages and such) is pretty messy. Looks like Jetty is sending newlines (only) to the console. OS/2 Warp's VM zealously respects that, and you end up with this sort of problem:

Jetty startup message
                      Next startup message
                                           Third startup message
which doesn't look all that great. But it's purely a cosmetic problem, and you can redirect Jetty messages to a file, then view the file later with most text editors, to see better results.

I've asked the Jetty community if they'd like a pre-written startup script for Jetty on OS/2 Warp. So perhaps you'll see a ready-to-go REXX startup script in a future version of Jetty. (If you run across any other Java-oriented projects, try to make the same offer. It will make life a lot easier for your fellow users, and most of the project communities are grateful for the contribution.)

References:

jetty:// website - http://jetty.mortbay.org
JBoss - http://www.jboss.org
GTak - http://ftp-os2.nmsu.edu/cgi-bin/h-search?key=gtak
GZip - http://ftp-os2.nmsu.edu/cgi-bin/h-search?key=gzip


[Feature Index]
editor@os2voice.org
[Previous Page] [Newsletter Index] [Next Page]
VOICE Home Page: http://www.os2voice.org