Installing a Java application on Linux

Some Java applications come packaged in an RPM. But if the Java application you are interested does not, never fear. Installation is easy.

Naturally, what follows assumes you have Java itself installed and working.

INSTALLATION
Create a directory for the application. Different people have different ideas on where is best; my preference is to place them in /opt. On my systems /opt is on a separate partition, so I don’t lose my Java applications even if I have to format the root and home partitions.

Download the application, which will usually be compressed in some manner. Uncompress it into the directory you created for it. Your application is now installed. Easy, wasn’t it?

ADDING A MENU ITEM FOR THE APPLICATION
All that remains is to add a menu item for the application; how this is done depends upon your desktop environment or window manager. What follows assumes you are using one that complies with the freedesktop.org’s standards (e.g. Gnome, KDE, Xfce).

Review the uncompressed files to see if the authors included a file that ends in “.desktop”. This so-called desktop file is what automatically provides a menu item for your application. You probably will not find one — a desktop file is typically provided only in the RPM versions of Java applications — but if you do, copy it to one of these two directories:

  • ~/.local/share/applications/ (to add the application to the menu of a single user)
  • /usr/share/applications/ (to add the application to all users’ menus)

And you are finished.

If your application didn’t come with its own desktop file, then write your own. Don’t worry; it’s easy. First determine the command line argument to launch your new application. Locate the executable, which is usually in the installation directory root and named “application_name” or “application_name.jar”. Make sure it is executable, and try to run it with the command (as user):

java -jar /path/to/application_name.jar

The application should start. If not, modify the command as necessary until it works.

Optionally, locate a menu icon to accompany the menu entry. One or more icon are normally included in the package you downloaded, or you can look for a generic icon on your system to use.

Now you have the information you need to create a desktop file. In your favorite text editor, modify the following example:

[Desktop Entry]
Comment=
Exec=java -jar /opt/omegat/OmegaT.jar
GenericName=Translation Memory Tool
Icon=/opt/omegat/images/OmegaT.png
Name=OmegaT
Path=
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
Categories=Development;Translation;

Edit as appropriate. Then save the file as “application_name.desktop” (naturally, changing the filename) in either of the two directories noted above.

You should now have a menu entry that launches your new application.

REFERENCES
Modifying the Xfce application menu

Advertisements

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

2 Responses to Installing a Java application on Linux

  1. Pingback: Installing Java on Linux | A maze of twisty little passages

  2. Pingback: Fenix configuration notes | A maze of twisty little passages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s