Executable files (built programs and shell scripts) normally go in /bin or /usr/bin but what about a jar file? It is a 'program' making me think it should go in bin, but on the other hand it requires a script to start it.

I have a very simply script to start the jar.

java -jar myapp.jar

But where should I put the jar file its self?

  • 1
    /usr/share/java could be one place. Though if it's a user .jar it belongs more in one directory in your $HOME – solsTiCe Jun 9 '15 at 22:24

It depends on you, i would suggest not to use any place designated to store system wide binary files. Although you can put it in /usr/local/bin or any other designated place to store system wide binary files but as it is not a regular binary file you better put somewhere else. Your home directory may be a good place too.

Actually it does not matter where you are putting this as long as you are going to use full path to call it:

java -jar /path/to/myapp.jar

Whereas if you want to put it somewhere in your PATH, you can add the path to the directory containing the file to the PATH (put it in ~/.bashrc):

export PATH=$PATH:/path/to/directory

Make sure the directory does not contain anything else (otherwise it would be a great place for running random malicious commands !!).

Now you can also create an alias of the command, for example:

alias myapp='java -jar /path/to/myapp.jar'

put it in ~/.bash_aliases. Now you can run the application by just typing:


There is no definite location that you 'should' store your executable jars in. It is based solely on user preference. I find that keeping my executable jars on the desktop works best so i don't need to continuously travel through my file system to use them which can sometimes get lost if your memory isn't the best.

Also little sidenote, if you install Java 8 then you can use Oracles Java 8 Runtime so you can just double click on the jar.
Hope I helped answer your dilemma.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.