tags:

views:

45

answers:

3

I usually store the Java applications and JAR files that I download from the Web in the ~/Java folder on my computer (an OS X machine). I have been doing this since the days when I was a Windows user. However I think in UNIX based systems user local apps are conventionally stored in another directory. I have a feeling that this directory should either be /usr/local/, /usr/local/USERNAME, /opt/local, or /opt/local/USERNAME but I am not sure. Any ideas which directory can I use for this purpose?

Please note that, I am talking about archive files that I download from the Web, unpack and use locally and not programs that have installation scripts or MacPorts, etc.

A: 

You might wish to read the Filesystem Hierarchy Standard /opt or /usr/local are probably appropriate but you should read there FHS definitions first.

xenoterracide
or see Apple's version http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man7/hier.7.html#//apple_ref/doc/man/7/hierNote /opt/local is used by macports so you might be better off on /usr/local for shared code
Mark
A: 

There isn't any blessed way to do it. You may, however, run into having multiple versions of a jar, and then it just goes downhill from there.

I usually download the jars I need as a distribution, and unpack it to its own folder, and then add the jars to the projects I need them for in my IDE. For libraries a common approach is to use Maven and its dependency handling.

So, my suggestion is to keep your current way of doing it, if you like that, but have each project in its own folder, like

~/Java/jakarta-commons-net-1.1.8/commons-net.jar
Thorbjørn Ravn Andersen
@Thorbjørn: I know about JAR clashes, etc. and at the moment I am organizing them exactly like your example. However I was just asking about the conventions. Seems to be no conventions here though... :)
Bytecode Ninja
We still use CVS and we have established a habit of used libraries each being put in their own Eclipse project with source and javadoc defined, and those are checked into CVS too. This allows us to use Import -> ProjectSet to get a fully populated workspace without maven and fully in-house.
Thorbjørn Ravn Andersen
A: 

Apple have a note giving /Library/Java/Extensions as the directory for shared jars and ~/Library/Java/Extensions for jars just for yourself. These paths are on the classpath.

The jars can be anywhere as long as that directory is on your class path. (I use a version of Thorbjørn Ravn Andersen's sty;e I use ~/Library/Jar/akarta-commons-net-1.1.8/commons-net.jar)

Mark