Skip to content

Welcome to Tech by Example

Menu
  • Home
  • Posts
  • System Design Questions
Menu

How to create an environment variable for tomcat on Linux?

Posted on July 7, 2021July 7, 2021 by admin

Assuming that tomcat8 is installed at “/var/lib/tomcat8/bin/” on Linux system. We have all the environment variables in a sample file setenv.sh as explained below.

Contents of setenv.sh:

export variable=value

Please follow the below steps. It’ll export the environment variable that can be accessed by the tomcat service.

sudo su 
cd /var/lib/tomcat8/bin/
cp /User/testuser/setenv.sh .      
chmod 777 setenv.sh
sudo service tomcat8 restart 
©2025 Welcome to Tech by Example | Design: Newspaperly WordPress Theme