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