Glam Prestige Journal

Bright entertainment trends with youth appeal.

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?

2 Answers

sudo ./startup.sh command will execute the startup.sh script in your current directory.

This you should do:

Add this line to /etc/profile for setting path while booting( Permanent change)

export CATALINA_HOME=/opt/apache-tomcat-8.0.24

To set path temporarily execute above command in the current shell.

and excute this:

sudo $CATALINA_HOME/bin/startup.sh

Two issues:

  • You also need to export the variable into the environment as follows:

    export CATALINA_HOME=/opt/apache-tomcat-8.0.24

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:

    cd /opt/apache-tomcat-8.0.24/bin/

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy