Viv¿ Java et Blackdown!

Mono, which is Ximian Inc.'s open-source implementation of some of the Microsoft Corp. .Net development framework, seems to be a hot button for both fans and critics of .Net. Just bringing up the topic of Mono also seems to generate a surprising degree of animosity toward Sun Microsystems Inc. and Java. These passionate reactions inspired me to embark on a project to develop several Web applications using Java, Mono and possibly other alternatives to provide readers with a first-hand view.

The comparison is already proving to be more ambitious than I had realized, and I hope to complete the first installment soon. In the meantime, my preparations produced several revelations about Java on Linux. The most startling is I now find myself enjoying client-side Java applications. I confess buying into the propaganda that while Java is great for server-side applications, it is almost useless for client applications. While this was once true, Java became a viable client platform. The mainstream press and I missed the transition.

To be fair, Java performance on Linux has yet to reach its potential. For one thing, the instance-based threading model of the 2.4 Linux kernel hampers the Java virtual machine. Various alternative threading options are evolving on Linux, but the most promising ones revolve around the 2.6 kernel (currently in its 2.5 development phase). I suspect we'll have to wait until the 2.6 kernel is ready before the JVM fully benefits from multi-threading. Java beats C++ under some conditions in some published benchmarks. However, the applications I've tried still don't seem to live up to the benchmarks because they don't seem to perform as well as C++ counterparts. That's not surprising. Tests I've seen focus on Windows or other platforms, and are generally academic in nature. More importantly, they fail to account for the impact of a complex user interface.

The performance curve of Jedit

Now that I've been fair, I am still impressed with the current state of Java for client applications. If you want to get a feel for how much I believe Java has improved, here's a point of reference that should remove all doubt, especially if, like me, you're a speed freak when it comes to programmer's editors. Until now, I used console-based editors like Joe (Joe's Own Editor), Zed, and my most recent nomination for best console editor, Fte (Folding Text Editor). The primary reason I use console-based editors for programming is that they're fast. I've chosen the above editors in particular because they combine speed with flexibility, features and the ability to customize them to use my favorite keystrokes.

Note, however, that I did not choose the above editors because of a religious dedication to using console programs over editors with graphical user interfaces (GUI). I would prefer an editor with a GUI. While there are many excellent open-source GUI editors from which to choose, I have yet to find one that offers the advantages of Joe, Zed or Fte without paying a price in features, keyboard configuration difficulty, increased start-up time or sluggish performance.

If all the many excellent GUI-based editors written in C and C++ were not appealing enough to draw me away from my console favorites, surely a Java-based editor would be out of the question, don't you think? Yet, precisely the opposite turned out to be the case. I now do all my coding with a Java-based open-source programmer's editor called Jedit.

If that isn't enough irony for you, my experiences with Jedit contributed to my former pessimism about Java as a client platform on Linux. I tried Jedit and other Java-based client programs two years ago. While every application I have tried was usable, the programs took too long to load, ran too slowly, and many were terribly error prone. Of course, improvements in hardware have helped, but not as much as you might think. About two years ago, I upgraded from a 700-MHz Pentium III with 256MB of RAM to a 1-GHz Athlon with 256MB of RAM. Just over a year ago, I upgraded to a 1.2-GHz Athlon with 512MB of DDR RAM.

Given the similar performance characteristics of these PCs, especially the latter, I cannot attribute all of the improvements in performance to faster processors and RAM. Both the applications and the Linux JVMs must have improved, as well. If anything, a 1.2-GHz processor is bottom of the line at this point, yet Jedit performs well within acceptable limits even when running a dozen other resource hogs.

Creature features

Jedit's features run the gamut. Jedit includes syntax highlighting and other language-specific features for many languages and file types, including everything from Java, PHP, C++, XML, HTML and XSL to Povray, C# and VBScript. Regardless of the language or mode you are using, Jedit is intelligent about matching and highlighting all kinds of brackets and braces, and even automatically matches opening and closing HTML tags. You can choose from a few methods of "code folding."

Folding is a technique that compresses and expands chunks of code (usually functions, classes or common blocks such as "if" or "while"). This makes it much easier to navigate through large source files. Depending on the folding method you use, Jedit will draw a gray line between functions or blocks of code (such as "if-else" blocks) and their closing braces. This is yet another way to see instantly if you have properly matched braces in Java or similar languages.

I was comfortable with the default keyboard assignments immediately, but you can customize them easily without editing a single configuration file. The Jedit global options control panel lets you define primary and alternative keystrokes for dozens of editor functions. If you learn the proper abbreviations or define abbreviations on your own, Jedit will recognize them and automatically insert words, phrases and chunks of code. You could conceivably get Jedit to do most of your coding grunt work this way. Add the powerful macro capability of Jedit to the mix, and you have a very automated programmer's editor on your hands.

The above features along with the simplicity of common editing functions would be enough to make Jedit a winner, but this barely scratches the surface of what Jedit can do. Like many Java-based editors and integrated development environments, Jedit supports plug-in modules. Its integrated plug-in manager lets you query the Internet for updated plug-ins, then downloads and installs them at your whim. Even though you can do all this without exiting Jedit, you must restart Jedit for new or updated plug-ins to take effect.

Thanks to plug-ins, the file selector includes seamless FTP access. I can retrieve files from my Web site right from the file selector as if they are stored locally, edit them and then save them. The distinction between local and remote files is so transparent that it's sometimes hard to remember I'm editing PHP files on a live server.

Then there are class browsers, class wizards, debugger integration, compiler integration, a console, an IRC chat plug-in, multiple means of reformatting and beautifying text according to different coding standards and much more. Thanks to the fact that many of these features are plug-ins, you can keep the editor reasonably slim and simple if you don't want any added bonuses.

Admittedly, you can find many of the cool features in other editors. Emacs, for example, includes every feature ever conceived by humans and many that weren't. I assume the latter group programmed the user interface, since the keystrokes seem to have been designed for creatures with four hands and fingers that bend differently than mine. Call me lazy, but I have a problem with things like Ctrl-X, Ctrl-S to save a file, which is typical of Emacs. Even though Emacs probably offers more add-in features than Jedit, I'd still use Jedit to avoid having to reconfigure the editor to use sane keystrokes. Nevertheless, since other full-featured editors like Emacs exist, you are probably justified in wanting to stick with what you already know and love. If you're even the least bit unsatisfied with what you're using, however, I strongly recommend you check out Jedit.

The resistance movement

A common concern Linux folks have with Java is Sun not make it available with a GNU or similar license. That's one reason why it's not so simple to get Java running on Debian. It isn't impossible to get on Debian, though (not yet, anyway).

I recommend using the most recent JVM or Java SDK you can find. As far as I can tell, it really boils down to two candidates:

  • SDK from Sun
  • Blackdown

You needn't sweat the decision. Sun uses the code from Blackdown as the basis for its SDK, so the two distributions are very similar. In some respects, the Sun version is more complete, but Blackdown offers some extra goodies you won't get from Sun, such as the Java Web Start utility (a way to launch Java applications from a browser). King Solomon-like, I installed both. I use Backdown's Java Web Start and Sun's SDK. If you download the full SDK or the Java runtime environment (JRE) from Sun, then installing it on Linux is as simple as running the file you've downloaded. It will extract itself into the Java distribution, which you can move anywhere you like (or, if you prefer, you can run the file in the directory where you want to install it). Mine is installed in /usr/lib/j2sdk-1.4.1. I created a symbolic link to /usr/lib/java, which is what I use as my Java home directory.

Here are the ways you can get Blackdown's Java specifically on Debian. Add something like the following to your /etc/apt/sources.list.

deb testing main non-free
deb unstable main non-free

The URL has a list of mirrors, one or more of which may be closer to your location, so substitute the best mirror and path for

Here's the command to install the Blackdown development kit and runtime environment:

apt-get install j2sdk1.4 j2re1.4

Apt-get may install dependencies automatically, depending on what else is already on your machine.

If you want to install the Sun JDK 1.4.1 Debian-style, you can download an unofficial Debian package for the Sun JDK 1.4.1 from, thanks to the work of a fellow named Tony.

Nicholas Petreley is a computer consultant and author in Asheville, NC. He can be reached at

This story, "Viv¿ Java et Blackdown!" was originally published by LinuxWorld-(US).

Copyright © 2003 IDG Communications, Inc.

7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon