Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.