I'm trying to set up Apache Tomcat on my pc, and it wants me to set up an environment variable for CATALINA_HOME. Does any know how to do this?
|
|
||||
|
|
|
In bash you can set variables like this:
most other shells follow this convention, but not all. You can set it permanently in |
|||||||||||
|
|
Environment variables should already work If you are using the tomcat6 package from the Ubuntu repositories, then the CATALINA_HOME and other environment variables are already set, in the If you are installing tomcat outside the package manager (hopefully in /opt or somewhere else outside the managed file system), then running the Setting the Environment variable If for some reason you still need to set an environment variable you can open a terminal window and type in the command:
This environment variable will now work within that terminal window, but if you open another window or logout/login you loose that setting. Make the environment variable permanent To make the environment variable setting permanent, there are several places you can define the setting. To be really sure the setting is being picked up, add the above setting to one of the startup script for tomcat:
Note: startup.sh calls the catalina.sh. You should add the setting at the start of one of these files (after any initial comments) The standard way for global environment variables would be to add an entry in
Not recommended You can set the environment variables in the bash (command line shell) configuration files, but these are not recommended as they are not always picked up (eg. if you are running a server that you dont login to to run tomcat): ~/.bashrc | ~/.profile | /etc.bash.bashrc | /etc/profile |
|||
|
|
|
The best place for this depends on how and where you've installed Tomcat, what applications you want to pick up this setting and how global you want the scope to be. The Ubuntu documentation on Environment Variables discusses the pros and cons of the various options. |
|||||
|