Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
    
Just to add that the file my_app.extension needs probably to tell terminal what program to use, for example sh files have the #bin/bash line. I don't have experience in java programming, so I can't tell if java files needs such instructions for terminal. –  papukaija Feb 16 '11 at 1:14
add comment

definately better to keep 'local' changes out of a distribution area. When you need to upgrade later, you changes won't be removed or the upgrade won't fail because of an errant file. You just need to change the CLASSPATH environment variable to include the jar files in your home directory.

Since you are specifying your home directory, I assume that this is a personal project, not one to be published somewhere. If it a project to be published, then there should be a directory, likely named 'lib', under the project's distribution; for example, /usr/local/xyzzy/lib/*.jar (for the project 'xyzzy').

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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