6

This file is needed to run this program. I am new to Mac OS X and its terminal.

I am installing Apache Tomcat, using steps provided through this URL http://www.editrocket.com/articles/tomcat_mac.html, but when I run

sh startup.sh

I get the following error:

Cannot find /Users/user/tomcat/bin/setclasspath.sh
 This file is needed to run this program. 

Whereas setclasspath.sh already exists at this location.

2
  • 1
    What happens if you use ${HOME} in place of /Users/user?
    – johnsyweb
    Dec 15, 2012 at 6:18
  • Your permissions are probably not set right. Paste the output of the following command: ls -al
    – Diego Basch
    Dec 15, 2012 at 6:40

5 Answers 5

4

Check your CATALINA_HOME by doing echo $CATALINA_HOME

This should point to your where tomcat is installed.

Add this line in your ~/.bash_profile and source it.

export CATALINA_HOME=/path/to/tomcat-x.x
1

I know this is an older post, but I've come across this issue, as I have multiple instances of Tomcat on my dev machine, and tend to have them in subdirectories of my user account, to keep them separate from what comes stock with OS X.

I've found it's better to have these sorts of settings self-contained, that is, in a setenv.sh file, for each instance.

SO, for example, if John Doe is running Tomcat v7.0.49, from within some directory he's created:

/Users/johndoe/Server/app/tomcat-7.0.49/bin/setenv.sh

And in that file:

export CATALINA_BASE="/Users/johndoe/Server/app/tomcat-7.0.49"
export CATALINA_HOME="/Users/johndoe/Server/app/tomcat-7.0.49"

This will work, pretty much from anywhere. You're now telling this particular Tomcat instance where to look for itself. Keep in mind, if you have multiple instances of the same Tomcat version in the same directory, you'll need to give each a unique parent folder name.

Also worthy of mention, CATALINA_BASE is optional, and will default to CATALINA_HOME, if you leave it out. Listing both is simply my personal preference.

1

I know it's an old question. I fixed this by specifying the full path of of CATALINA_HOME environment variable;

I changed;

CATALINA_HOME="~/Servers/tomcat"

To;

CATALINA_HOME="/Users/{my_username}/Servers/tomcat"

It's not supposed to make a difference but for some reason it does.

0

I Googled your error and found the following result from malisphoto:

If you received the error "Cannot find /Library/Tomcat/Home/bin/setclasspath.sh," you are probably trying to install Tomcat in your home directory Library (~/Library). Either install Tomcat in the root Library (/Library) or point CATALINA_HOME to your home directory Tomcat installation directory, probably something like CATALINA_HOME=/Users/username/Library/Tomcat/Home. A basic installation doesn't require setting CATALINA_HOME or JAVA_HOME for that matter.

If this is not your issue, I would suggest trying to open the file directly from the terminal using that same string of text, to make sure that the file is definitely there.

1
  • @user1905811 No i have not installed Tomcat in my library directory, Its is being installed under username. I tried running this command as you mentioned CATALINA_HOME=/Users/username/Library/Tomcat/Home but nothing happened . Still i am not able to launch sh startup.sh
    – Ankit
    Dec 20, 2012 at 5:48
0

You need to set two lines at two places:
The path details are:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export CATALINA_HOME=/opt/tomcat/apache-tomcat-7.0.90

Put these paths at the end of the lines.
Files that you want to edit:

vi ~/.bashrc
vi ~/.bash_profile

and

./shutdown.sh
./startup.sh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .