Skip to content
Advertisement

The conventional location for storing my Java libraries and applications in UNIX based systems

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.

Advertisement

Answer

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
Advertisement