In this installment, I'd like to touch on an oft-forgotten but increasingly important component of the Linux desktop: Java applications. Since Java is largely distribution neutral, what Java code works on Fedora Core works for Debian, Red Hat, SuSE, Mandrake, and any number of other distributions. And, yes, Java applications really do exist, and some are actually good.
In this installment, I’d like to touch on an oft-forgotten but increasingly important component of the Linux desktop: Java applications. Since Java is largely distribution neutral, what Java code works on Fedora Core works for Debian, Red Hat, SuSE, Mandrake, and any number of other distributions. And, yes, Java applications really do exist, and some are actually good.
Due to licensing issues (bundling Java with an operating system is a significant expense), Linux desktop distributions typically omit the Java Virtual Machine (JVM), the engine that runs all Java applications. But for our purposes, as end-users, that’s moot: anyone can download and run Sun’s Java 2 Standard Edition for free.
There are actually multiple JVMs you can get. One is the Java 2 Runtime Environment (JRE), and the other is the Java 2 Standard Edition Software Development Kit (Java 2 SE SDK). The first is just the engine itself, and is all you need to run pre-packaged Java applications on a Linux machine. The other, the SDK, is a much larger download and contains not only the JRE, but also the .class files and materials you need to develop Java applications. Building Java applications is beyond the scope of this article, so let’s focus on the JRE version.
To download the JRE, visit http://java.sun.com/j2se/1.4.2/download.html and download the latest version. At the time of this writing, Java2 1.4.2 was current and 1.5 was in beta. I’ve found that the beta JREs aren’t necessarily compatible with some of the software in this article, since the application authors don’t qualify them until the official JREs are released. I’d stick to the most current stable version.
The JRE comes packaged in a .bin file, which is a compressed executable. It will probably be named something like j2re-1_4_2_05-linux-i586-rpm.bin. Once you’ve downloaded the .bin file, fire up your favorite terminal program, change to your home directory (or the directory you downloaded the file in), and run:
$ sh j2re-1_4_2_05-linux-i586-rpm.bin
Scroll through the long disclaimer and license agreement and answer “yes” when prompted (if you are so inclined). Next, use sudo (or su to root) to install the software.
$ sudo rpm -Uvh j2re-1_4_2_05-linux-i586.rpm
Congratulations! You’ve now successfully unpacked and installed the JRE on your Linux system. However, because there’s no standardized layout for Linux file systems, you need to alter your PATH so that the Java executable can be called from within various startup scripts and from the shell itself. cd to your home directory, and using your favorite text editor, edit the shell startup file that defines your PATH.
For example, if you use bash, edit ~/.bash_profile and change the line…
… (or something like it) to add JRE’s bin directory, like so:
Save your .bash_profile, log out and log back in to update your PATH. Each user, including root, that wants to run Java applications, must change his or her PATH.
To test your path, bring up a terminal session again and type the following:
If you see something like…
java version “1.4.2_05″
Java(TM) 2 Runtime Environment, Standard
Edition (build 1.4.2_05-b04)
… Java is working. Now for some fun: Java applications that you can use.
Torrenting with Java using Azureus
Unless you’re totally oblivious to the Internet peer-to-peer networking and file sharing community, you’ve probably heard of BitTorrent (http://bitconjurer.org/BitTorrent). BitTorrent is a file sharing protocol that’s rapidly gaining in popularity, because of its efficiency, speed, and ease of use. BitTorrent distributes each download across many servers, can be throttled to limit uploads and downloads, and can even suspend and resume downloads. BitTorrent is also the preferred mechanism for distributing various Linux distributions, such as Fedora Core, and it’s ideal for downloading large files such as CD-ROM and DVD ISO images.
To get started with BitTorrent, download a copy of Azureus. Azureus is a BitTorrent client written in Java. It’s easy to use, is extremely stable, has a lot of features, and, well, is just plain cool. The Azureus download site is hosted on SourceForge at http://sourceforge.net/project/showfiles.php?group_id=84122.
|Figure One: The Azureus BitTorrent client|
Download the latest Linux version. I happen to be partial to the one that uses GTK bindings (see Figure One), but the Motif version works very well, too. At the time of this writing, the filename for the GTK version was Azureus_188.8.131.52_ linux. GTK.tar.bz2, which is doubly compressed. To uncompress it, go to your handy-dandy terminal window again and issue the following commands:
$ bunzip Azureus_184.108.40.206_linux.GTK.tar.bz2
$ tar xvf Azureus_220.127.116.11_linux.GTK.tar
This should leave you with a subdirectory called azureus. At this point, it’s probably a good idea to move the azureus directory with your favorite file manager to a place like /usr/share so that it doesn’t clutter up your home directory.
Once you’ve moved the azureus directory, you should be able to run it with the azureus executable script in the azureus directory by either creating a program icon on your KDE or GNOME desktop or executing it with ./azureus from the terminal window.
Once the application is open, you can cut and paste the URLs of the torrents that you want to download. (A torrent describes what to download and how. See the sidebar “Torrent-ial Downloads” for more information.) Choose “File, Open, URL” to specify a torrent file.
BitTorrent is a peer-to-peer protocol that allows individual users to share files across the Internet. Unlike many other peer-to-peer protocols, BitTorrent downloads files in small pieces from multiple sources simultaneously. A special catalog called a torrent file specifies the canonical server for the file and specifies a unique identifier used to find other sources for the file. (A torrent also includes file sizes and checksums that are needed to reassemble and validate a download.)
Torrent trackers are lists of URLs that point to torrents. Tracker sites, such as TorrentReactor.net, suprnova.org, and bitoogle.com, are places where you can look for torrents.
Not all torrent content is distributed legally. Some may be subject to copyright laws in your country, such as the United States Digital Millennium Copyright Act (DMCA). If caught with such material on your computer or in your possession, you can be prosecuted.
So keep your nose clean, OK?
The “Configuration Wizard” allows you to pick a standard configuration for your connection type, and you can tweak it further by choosing “View, Configuration, Transfer.” Your BitTorrent downloads will appear in your home directory as individual directories or files.
Like BitTorrent, LimeWire (http://www.limewire.com, Figure Two) is another peer-to-peer file sharing application, and it’s also written in Java. Limewire uses the very popular Gnutella network to download and share files, which can be of virtually any multimedia file type, including .jpg, .MP3, .mpg, .txt, .PDF, and .wav.
|Figure Two: The LimeWire peer-to-peer file sharing client|
Unlike BitTorrent, which requires a specific .torrent file and URL to download media, LimeWire uses an integrated search engine and talks to Gnutella servers (so-called “supernodes”) to find machines hosting the file you’re searching for. Like BitTorrent, Limewire downloads tiny pieces of files from multiple sources simultaneously, thereby sharing the load. You can also start or resume LimeWire downloads at any time.
To download LimeWire, go to http://www.limewire.com and download the LimeWire Basic (free) or LimeWire Pro client. The basic client for Linux is available at http://www3.limewire.com/download/LimeWireLinux.bin.
After you have the file, open up your favorite terminal program again and run sh LimeWireLinux.bin. This launches the LimeWire installer program. When prompted for an installation directory, use /usr/share/LimeWire/ or /home/ LimeWire/.
Once installation is complete, you should be able to start LimeWire by running ./LimeWire from within the /usr/ share/LimeWire directory.
LimeWire is fairly straightforward to use. Once it connects to the Gnutella network, you can search for files. Right click on the file you want to download and select Download. By default, files appear in ~/Shared.
Other Java Applications
Azureus and LimeWire are just a start. Here are some other Java applications you might want to try:
* JPhotoBrush is a Paint Shop Pro- and Photoshop- like application written in Java that has some nice special effect features and is very easy to use. If you’re looking for something for cropping and touching up for your digital photos and don’t want to learn something as sophisticated as The GIMP, JPhotoBrush is a great little program. However, it’s commercial software and costs $25. You can download a trial version at http://www.jphotobrushpro.com.
* JFTP is a nice, feature-packed, graphical FTP client that supports SSL connections for secure transfer of files. While it’s commercial software, you can download a non-commercial license of it by registering with http://www.myjavaworld.com.
* JAlbum is a graphical Java application that creates web albums of your favorite digital pictures to upload to your web site. JAlbum is donation-ware, meaning that if you like the application, you’re encouraged to send a $20 donation to the author, David Ekholm. You can get JAlbum at http://www.jalbum.net.
Stay tuned to “On the Desktop” for more great Java programs.
Jason Perlow is a geek and gastronomer. For serious coders, Jason recommends Jamaican Blue Mountain or Jolt Cherry Blast. You can reach Jason at firstname.lastname@example.org.