Just how do I set environment variables?

I'm attempting to set up Apache Tomcat on my computer, and also it desires me to set up a setting variable for CATALINA_HOME. Does any kind of recognize just how to do this?

2019-05-06 23:41:48
Source Share
Answers: 3

The ideal area for this relies on just how and also where you've mounted Tomcat, what applications you intend to grab this setup and also just how international you desire the extent to be.

The Ubuntu documentation on Environment Variables reviews the benefits and drawbacks of the numerous alternatives.

2019-05-08 22:18:28

In celebration you can set variables similar to this :

export CATALINA_HOME=/opt/catalina

most various other coverings follow this convention, yet not all. You can set it completely in ~/.profile for celebration (and also as in the past, various other coverings have various other areas)

2019-05-08 19:52:10

Environment variables need to currently function

If you are making use of the tomcat6 plan from the Ubuntu databases, after that the CATALINA_HOME and also various other environment variables are currently set, in the /etc/init.d/tomcat6 start-up manuscript.

If you are mounting tomcat outside the plan supervisor (with any luck in/ decide or elsewhere outside the taken care of documents system), after that running the TOMCAT/bin/startup.sh needs to make use of the loved one area to specify the CATALINA_HOME.

Establishing the Environment variable

If for one reason or another you still require to set a setting variable you can open an incurable window and also key in the command :

export CATALINA_HOME=/path/to/the/root/folder/of/tomcat

This setting variable will certainly currently function within that incurable window, yet if you open an additional window or logout/login you loose that setup.

Make the setting variable irreversible

To make the setting variable setup irreversible, there are numerous areas you can specify the setup.

To be actually certain the setup is being grabbed, add the above setup to among the start-up manuscript for tomcat :



Keep in mind : startup.sh telephone calls the catalina.sh. You need to add the setup at the beginning of among these documents (after any kind of first remarks)

The typical means for international environment variables would certainly be to add an access in /etc/environment (you do not make use of the command export in this documents as it is not a regular celebration manuscript)


Not advised

You can set the environment variables in the celebration (command line shell) arrangement documents, yet these are not advised as they are not constantly grabbed (eg. if you are running a web server that you do not login to to run tomcat) : ~/. bashrc | ~/. account | / etcbash.bashrc | / etc/profile

2019-05-08 07:29:54