I'm building a .deb file for an executable jar I've built for myself. I got a .deb built and installed my program to /usr/bin.

As I have a jar I now had an executable file called /usr/bin/mylovelyprogram.jar. I noticed that no other files in the directory had an extension.

Now, I know that having an extension or not doesn't matter, but it did bother me since my program stood out. I wondered if it was usual to rename packaged executable jars such that they no longer have an extension? Or, if there was some other standard e.g. putting the jar somewhere else and using a symlink? I'd like to conform to existing standards where possible, mainly so I do not fall into bad habits if I ever decide to distribute my program.

2 Answers 2


The "standard" unix location for local packages (things that are specific to one computer, and not a whole network installation) is /usr/local

Many Linux distributions choose to break this standard and just dump everything in /usr, or (heaven forbid) /opt! (don't you just hate it when some application decides to fill up your root partition because it's dumped itself in /opt which didn't exist before hand? mentioning no names, libreoffice...)

Your jar file is effectively a library, and should be in somewhere like /usr/local/lib/myapp/

You should have a small script in /usr/local/bin which calls your jar file using the java virtual machine.

java -jar /usr/local/lib/myapp/myjar.jar $*

And of course you should be sure that /usr/local/bin is in your $PATH

This arrangement stops your software from getting mingled up with the operating system software, and also keeps it on a partition which should have plenty of room. It also fits in nicely with non-Linux systems as well, which, as it's Java, you are fully expecting it to be running on, yes? That is after all the whole point of Java, isn't it? Cross-platform?

  • I've rebuilt by .deb to install to /usr/local/lib/myapp/ - thanks for you advice. However, when I tested removing the package I got the following warning from "dpkg: directory '/usr/local/lib' not empty so not removed." (and several other similar warnings). I don't want dpkg to even try to remove that directory (for obvious reasons!) how do I stop it trying to doing so?
    – Peter
    Apr 11, 2011 at 15:00

The other files in /usr/bin most certainly are no java applications.

Your jar is not an executable file on its own, it needs to be opened and executed by the java executable. Double clicking it will do the magic (of executing java -jar your.jar) in the background.

IMHO your jar doesn't belong to /usr/bin. /opt/yourapp would be wiser. See this question here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .