Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to set the JAVA_HOME path in Ubuntu from the .bashrc file I currently have something like

export JAVA_HOME=/usr/local/jdk1.6.0_24

But I want to also add the servlet libraries in the Tomcat folder to the path. I tried doing this:

export JAVA_HOME=/usr/local/jdk1.6.0_24,/usr/local/tomcat/lib

But that just broke the JAVA_HOME path. How can I add the Tomcat path to the original JAVA_HOME path?

Thanks, Alex

share|improve this question
up vote 3 down vote accepted

First, JAVA_HOME should only contain the actual Java installation directory. Normally, additional classes should be added to CLASSPATH, with directories separated by : eg

export CLASSPATH=$CLASSPATH:/usr/local/tomcat/lib/:/somewhere/else/

Unfortunately, it seems that Tomcat does its own thing, and that thing has changed with every major version of Tomcat. This guide should help you figure out how to do what you're trying to do with whatever version of tomcat you have.

share|improve this answer
Actually, I have this now: JAVA_HOME=/usr/local/jdk1.6.0_24 export CLASSPATH=$CLASSPATH:/usr/local/tomcat/lib export JAVA_HOME and it still can't locate the tomcat libraries during compilation. Does the order of exporting and setting the variables matter? Is rebooting required? – Genadinik Apr 11 '11 at 16:38
@Genadinik if you run env what does it show for JAVA_HOME and CLASSPATH? – DerfK Apr 11 '11 at 18:03

Try separating them with a colon (:).

share|improve this answer

Your Answer


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.