I administer a linux box with many java users. I noticed that many users downloaded several jakarta projects or other open source projects and included the relevant jars in their own directories, and manually edited their CLASSPATH each time they added a jar. I decided to make a central repository (/usr/local/jars) for all the jars, and make a csh script to automatically set the classpath as well as some other variables. I figured I would share it in case anyone else wants to use it, translate it to bash, or offer suggestions. I have put this in /etc/javasetup.csh:
And now all I have to do to add more jars is to either move it into /usr/local/jars or make a symbolic link from /usr/local/jars to the package. All users can include the line "source /etc/javasetup.csh" in their .cshrc file. It also allows me to update the jdk and merely change one line in the javasetup.csh to allow all users to use the updated jdk. I have tried making a sh/bash script too, though my knowledge of bash is limited.
Please feel free to use/modify/point out any bugs or platforms where these don't work. Or offer suggestions on what you have done differently. Chris
Joined: Sep 09, 2003
Be ready to deal with a lot of broken Apps I have spent countless hours of debugging due to the wrong xalan.jar or xerces.jar in my application. And this is when I could control my own jar files and CLASSPATH! Imagine what would happen if someone else was constantly modifying the CLASSPATH and the jar files!
No one has to use the CLASSPATH I define, and so far it's working well. If a particular package becomes a problem, then we can figure out if we want to exclude it from the scheme or not. Right now we don't have xalan.jar or xerces.jar in the /usr/local/jars directory. Also, this is not a huge multiuser system... Only 12 users in one workgroup, so communication is not as big an issue as if it were a 100 user system. That said, I am worried that someone might request that a jar be updated only to find that it breaks someone else's application. In that case, I'm not sure what we could do to consolidate. For that jar we would probably stick with the old version and the user who needs the new version would manually use the new version. Right now only 5 of the users (including myself) are using the csh script, and no one is using the bash one. Chris [ October 08, 2003: Message edited by: Chris De Vries ]