Ubuntu – Where should I store 3rd party jar (Java archive) files

downloadsjavapathspermissions

What would be the best place to save jar files of libraries I want to use in a project, that are not in any repositories, and how should I set permissions?

Should I put them in /usr/share/java, or is it better to store them somewhere in my home folder?

What would be the most usefull access rights? Does it make sense to follow the convention in /usr/share/java of making a symlink with the package name to the specific version of the jar, and follow the permissions as used there?

Best Answer

If all the users in your system don't need access the files, you can put them in your home folder or even better in bin folder (create one if not already done) under your home folder. That way you have a personal bin directory which can be accessed from terminal without specifying the file extension or the program to open the file.

For example,

my-app

would make the terminal to run my-app.any_possible_extension with proper program (Sun's Java or Openjdk in this case). If you create the bin folder, you need to log out and log back in order for the system to recognise the new bin folder. Also, files in the personal bin folder must have been set as executable, otherwise terminal will ignore the file.

Related Question