0

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

Genadinik
  • 1,103
  • 4
  • 19
  • 39

2 Answers2

3

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.

DerfK
  • 19,493
  • 2
  • 38
  • 54
  • 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
1

Try separating them with a colon (:).

Bart De Vos
  • 17,911
  • 6
  • 63
  • 82