It's not a secret anymore!
The moose likes Java in General and the fly likes Java on Unix: /home or /usr ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java on Unix: /home or /usr ?" Watch "Java on Unix: /home or /usr ?" New topic

Java on Unix: /home or /usr ?

Gabriel Cane
Ranch Hand

Joined: Mar 27, 2001
Posts: 39
I have a question for those of you who develop on a unix-based OS, such as Linux or FreeBSD.
Did you install your Java environment (JDK, J2EE, ant, junit, etc) in your /home directories, or did you install in a system directory, such as /usr/local?
The reason I'm asking is to know which is the best method in terms of saving disk space, user permissions, and finally, deployment of the application.
Also, if you're testing a servlet-based application, running tomcat, for example, would it be better to have tomcat running from /home, so that you wouldn't have to switch to root everytime you want to compile?
Any thoughts, perspectives or experiences will be appreciated.

Sun Certified Programmer for the Java 2 Platform
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

This is a matter of perspective, more than anything else. In projects to which several people contribute, a system view is far more appropriate. If you're doing it all yourself, and not planning to incorporate other workers when you scale, why not save yourself the switch-user action and speed things up.
Personally, I like to hope for the best (more help) and plan for the worst (recovering data in a bad crash) -- in both views, I prefer seeing Tomcat as a "system service," i.e., located in /usr/local or perhaps even /opt.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
I have a /usr/share/java directory Under that I have a j2skd1.4.0 directory for my SDK as well as other directories for jakarta ant, log4j and so on.
I then use "chgrp" to set the group for these directories to "java" (remember to do it recursivly) and then make my users members of the java group.
That seems to work well for me.

For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
I agree. Here's the link:
subject: Java on Unix: /home or /usr ?
It's not a secret anymore!