How create environment variable for tomcat?

Bohdan Olehovich picture Bohdan Olehovich · Sep 29, 2015 · Viewed 10.6k times · Source

I'm trying create environment variable in tomcat 8 for my project, I need use this variable for choice properties logger. I read about setenv.sh and i create this file, but when i run my project - it does not run. How me create environment variable for check my project? I read about setenv in this site. I use ubuntu 14.04.

setenv.sh

JAVA_HOME="/usr/lib/jvm/java-8-oracle"
export JAVA_HOME

JAVA_OPTS="-Xmx4096m -Xms512m -server"
export JAVA_OPTS

CATALINA_HOME="/opt/tomcat"
export CATALINA_HOME

Answer

Raushan picture Raushan · Jan 18, 2017

Please do the following. It'll work for you.

   1 sudo su and cd to /var/lib/tomcat8/bin/
   2 touch setenv.sh(if it doesn't exist)
   3 chmod 777 setenv.sh
   4 vim setenv.sh and set following line in setenv.sh
       export varriable=value
   5 sudo service tomcat8 restart 

and Enjoy...!!