The BASEDIR environment variable is not defined correctly This environment variable is needed to run this program

BASEDIR environment not define error and its solution

Are you working on J2EE with Tomcat?

Trying to run Tomcat from the command line and got this problem?

I got this while working on apache-tomcat 7.

Here is how I solved it.

The basedir environment will complain if you have either the JAVA_HOME and/or the CATALINA_HOME paths are not correctly set on the environment variables.

where to get the environment variable? -> in /etc/environment.
Once you make sure paths are set correctly, the next would be allowing the shell scripts to have the executable permissions.

Basically I would do
sudo chmod 777 -R /PATH/TO/TOMCAT/bin

This, as you know is not advisable if for production or networked environments as it will allow all to execute.

Now, you should be able to startup tomcat as
./startup.sh by going into the tomcat’s bin folder.

Recommended

What is can not access member of class with modifiers and its solution?

Change port in tomcat

See what the no persistence provider error mean for entity manager and how to solve it