bash 错误:找不到 /Library/...../setclasspath.sh,但它在那里

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11026376/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 22:14:44  来源:igfitidea点击:

bash error : Cannot find /Library/...../setclasspath.sh, but it's there

macosbashtomcatterminal

提问by codenamejupiterx

I'm trying to set up tomcat server and I am using the instructions from a website that has instructed me to

我正在尝试设置 tomcat 服务器,并且我正在使用网站上的说明,该网站已指示我

      # Execute the Tomcat startup script
      ./startup.sh 

but when i enter the ./startup.sh command i get an error

但是当我输入 ./startup.sh 命令时出现错误

      Cannot find /Library/Tomcat/Home/bin/setclasspath.sh

but the setclasspath.sh is there (see screenshot below):

但 setclasspath.sh 在那里(见下面的截图):

enter image description here

在此处输入图片说明

What am i doing wrong????

我究竟做错了什么????



now i cannot cd to Home (see screenshot below):

现在我不能 cd 到 Home(见下面的截图):

enter image description here

在此处输入图片说明

here is the path info: enter image description here

这是路径信息: 在此处输入图片说明

回答by ali

I had same problem on my mountain lion machine and I use this command :

我在我的山狮机器上遇到了同样的问题,我使用这个命令:

$ unset CATALINA_HOME

and after that it solved my problem.This command will unset the environmental variable CATALINA_HOME.

之后它解决了我的问题。此命令将取消设置环境变量CATALINA_HOME

回答by Macilias

just run: $ unset CATALINA_HOME in Terminal, and it works again.

只需运行: $ unset CATALINA_HOME 在终端中,它又可以工作了。

回答by satyajeet mahapatra

Please RESET the CATALINA_HOME to point to correct path. That should resolved the problem. for example; currently it might be at "/usr/share/tomcat6/" but you need to verify & point till the correct directory like "/usr/share/tomcat6/apache-tomcat-6.0.37/"

请重置 CATALINA_HOME 以指向正确的路径。那应该可以解决问题。例如; 目前它可能位于“/usr/share/tomcat6/”,但您需要验证并指向正确的目录,例如“/usr/share/tomcat6/apache-tomcat-6.0.37/”

回答by Mohammed Irfan Tirupattur

Its because of permission, you can run this using root $ sudo pathtotomcat/bin/./startup.sh

由于权限,您可以使用root运行它 $ sudo pathtotomcat/bin/./startup.sh

回答by Ankit

I too had similar issue and I am able to resolve it by simply changing the file permission of tomcat folder . Make it read and Write for everyone. And sh startup.shcommand would work fine with Tomcat/7.0.34

我也有类似的问题,我可以通过简单地更改 tomcat 文件夹的文件权限来解决它。让它为每个人阅读和写作。并且 shstartup.sh命令可以在 Tomcat/7.0.34 上正常工作

I got this solution from here

我从这里得到了这个解决方案

To make all scripts runnable:

要使所有脚本可运行:

sudo chmod +x /Library/Tomcat/bin/*.sh

I hope it solves your issue too.

我希望它也能解决你的问题。

回答by andilabs

The answer of ali is good, but for some reason I also needed to open .bash_profile and comment out CATALINA_HOME

ali 的回答很好,但是由于某种原因,我还需要打开 .bash_profile 并注释掉 CATALINA_HOME

回答by factotum

This happens almost definitely because of incorrect value of CATALINA_HOMEenvironment variable in your current shell. In my case for example I had an older tomcat install that I removed and installed another version but forgot to change the env var set in .bash_profile. So any of the methods suggested which remove the var will work. If you have CATALINA_HOMEset in .bash_profile, remove it. unset CATALINA_HOMEwould work too but if its in profile, it will again be set when you open a new shell.

这几乎肯定是因为CATALINA_HOME当前 shell中环境变量的值不正确。例如,在我的情况下,我有一个较旧的 tomcat 安装,我删除并安装了另一个版本,但忘记更改.bash_profile. 因此,建议删除 var 的任何方法都将起作用。如果已CATALINA_HOME设置.bash_profile,请将其删除。 unset CATALINA_HOME也可以,但如果它在配置文件中,则在您打开新外壳时将再次设置它。

回答by Elyas Hadizadeh

Although all mentioned answers look fine it's a good idea to be aware the main reason.

尽管所有提到的答案看起来都不错,但了解主要原因是个好主意。

Somewhere on your operating system, a file is setting environment variables for your operating system, one of those variable names is CATALINA_HOMEwhich is pointing to an address or path. when you attempt to run ./startup.shor catalina.sh run, these command needs the CATALINA_HOMEwhich is set by your operating system and will override the default CATALINA_HOMEof tomcat configuration. (You may have used tomcat and set this variable before and now you forget it)

在您的操作系统的某个地方,一个文件正在为您的操作系统设置环境变量,这些变量名称之一CATALINA_HOME是指向地址或路径。当您尝试运行./startup.sh或 时catalina.sh run,这些命令需要CATALINA_HOME由您的操作系统设置,并将覆盖CATALINA_HOMEtomcat 配置的默认值。(你之前可能用过 tomcat 并设置过这个变量,现在你忘记了)

So the main solution is to edit that special file and it really depends on operating system. In my case, Fedora, two files are candidate one of them is ~/.bashrcand another one is /etc/profile. After editing them you need to sourcethem or log outand then log in(On OS XI think it should be in /Users/username/.bash_profilefile).

因此,主要的解决方案是编辑该特殊文件,这实际上取决于操作系统。就我而言,有Fedora两个文件是候选文件,其中一个是~/.bashrc,另一个是/etc/profile. 编辑它们后,您需要source它们或log out然后log inOS X我认为它应该在/Users/username/.bash_profile文件中)。

of course unset CATALINA_HOMEcommand works but after closing and opening a new terminal, again you need to use this command due to refreshing.

当然unset CATALINA_HOME命令有效,但在关闭并打开新终端后,由于刷新,您再次需要使用此命令。

回答by Raj Chirag

U need to set two lines at two places

你需要在两个地方设置两条线

path details

路径详情

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

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

put this path at the end of the lines

将此路径放在行尾

files that you want to edit vi ~/.bashrc vi ~/.bash_profile

要编辑的文件 vi ~/.bashrc vi ~/.bash_profile

./shutdown.sh ./startup.sh

./shutdown.sh ./startup.sh

its works for me

它对我有用