Reputation: 2177
Im building some application, where i would like to get some variable directly from linux.
I know, that the command to get the variable is System.getenv(), but i don't exackly know where i should set variable in linux.
I'm using Centos, and my tomcat is set in /usr/share/tomcat6
I was thinking, that maybe i should write it in /etc/profile file, but it doesn't works, and additionally i think that i should past the variable in user folder. User for Tomcat is tomcat, and his folder is /usr/share/tomcat6.
Should i create there file profile
and add something like this? :
MY_VARIABLE=value
export MY_VARIABLE
Please help
Upvotes: 1
Views: 3516
Reputation: 1098
From Terminal:
gedit ~/.bashrc
~ here refers to /home/USER directory.
Edit the file:
MY_VARIABLE=value
export MY_VARIABLE
confirm changes:
echo $MY_VARIABLE
Upvotes: 1