I am not yet a Linux guy and I have the following problem with environment variable.
So I want to add a permanent environment variable and I do in this way:
I open the /etc/profile file and I add this line at the end of this file:
CATALINA_HOME=/opt/apache-tomcat-8.0.24
Where /opt/apache-tomcat-8.0.24 is the folder that contain the tomcat installation (it contains the bin TomCat subfolder)
Then I save this file.
So I close the shell and I reopen it and I try to do:
andrea@andrea-virtual-machine:/$ sudo ./startup.sh
sudo: ./startup.sh: command not found
To start the server instead enter into /opt/apache-tomcat-8.0.24/bin/ and perform the command.
But as you can see I obtain an error. What am I missing?
sudo ./startup.sh
command will execute thestartup.sh
script in your current directory.This you should do:
Add this line to /etc/profile for setting path while booting( Permanent change)
To set path temporarily execute above command in the current shell.
and excute this:
Two issues:
You also need to
export
the variable into the environment as follows:Since you are using
/etc/profile
, it won't take effect in X again, until you logout and in again of your xsession, not just your shell.Also
sudo
cannot find./startup.sh
. You need to be in the same directory as this script. By enter it, it means first: