java 警告所选目录不是有效的 tomcat 主目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33055786/
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
Warning the selected directory is not a valid tomcat home
提问by Olatunde Garuba
I installed Tomcat with home brew brew install tomcat
. On Selecting Tomcat server to add a server to the application server I get this
我用 home brew 安装了 Tomcat brew install tomcat
。在 Selecting Tomcat server to add a server to the application server 我得到这个
Warning the selected directory is not a valid tomcat home.
警告所选目录不是有效的 tomcat 主目录。
However, running catalina start
starts the tomcat server on my terminal.
但是,运行会catalina start
在我的终端上启动 tomcat 服务器。
采纳答案by Surge
Step 1.
步骤1。
Download the tomcat
with the tar.gz extension.
NB.The tar.gz
extention
下载tomcat
tar.gz 扩展名。
注意。该tar.gz
extention
Step 2.
第2步。
Unzip the file and make sure the folder name remain tomcat
, save it to your library.
解压缩文件并确保文件夹名称保留tomcat
,将其保存到您的库中。
Step 3.
第 3 步。
Access the preference settings on your intellijIDEA
访问您的 intellijIDEA 上的首选项设置
- Under Build, Execution and Deployment, select application server.
- Attempt to add a new server, click
+
and selectTomcat Server
from the drop down. - Click on the
...
elipse to select the folder you have unziped earlier into your library. - select the
tomcat
folder and boom.
- 在构建、执行和部署下,选择应用程序服务器。
- 尝试添加新服务器,单击
+
并Tomcat Server
从下拉列表中选择。 - 单击
...
椭圆以选择您之前解压缩到库中的文件夹。 - 选择
tomcat
文件夹和繁荣。
You are good to go, ready for use.
您已准备就绪,可以使用了。
回答by Hymanson
If you are using IDEA on Linux platform, use the command:
如果您在 Linux 平台上使用IDEA,请使用以下命令:
chmod 755 -R apache-tomcat-<<Your-tomcat-version>>
chmod 755 -R apache-tomcat-<<Your-tomcat-version>>
Then try to restart your service again.
然后尝试再次重新启动您的服务。
回答by Stepan
Try selecting the libexec
subdirectory in IntelliJ - i.e. /usr/local/Cellar/tomcat/8.5.9/libexec
尝试libexec
在 IntelliJ 中选择子目录 - 即/usr/local/Cellar/tomcat/8.5.9/libexec
回答by kervin
This recently came up for me on Ubuntu 17.04
这是最近在 Ubuntu 17.04 上为我提出的
What worked for me
什么对我有用
cd /var/lib/tomcat8
rmdir lib/
ln -s /usr/share/tomcat8/lib/ .
ln -s /usr/share/tomcat8/bin/ .
I'm not sure this is the best fix but it worked for me. For some reason the default install left the tomcat8/lib directory empty while the real libraries are under the share directory.
我不确定这是最好的解决方法,但它对我有用。出于某种原因,默认安装将 tomcat8/lib 目录留空,而真正的库位于共享目录下。
回答by RDONALDSON
Authorise permissions on Tomcat folder:
授权Tomcat文件夹的权限:
Open tomcat location e.g. C:\Program Files\Apache Software Foundation\Tomcat 9.0
Double click this folder.
Authorise permissions.
打开 tomcat 位置,例如 C:\Program Files\Apache Software Foundation\Tomcat 9.0
双击该文件夹。
授权权限。
Now try creating the server...
现在尝试创建服务器...
回答by Evgeniy
There may be a situation where the folder will be inaccessible to the user due to lack of rights. Try to open the root folder of Tomcat and click OK to get rights to it. This worked for me.
可能会出现用户由于缺乏权限而无法访问文件夹的情况。尝试打开Tomcat的根文件夹,然后单击“确定”以获取权限。这对我有用。
回答by jtcotton63
I did what CallmeSurge suggested, except I had to change the following:
我按照 CallmeSurge 的建议做了,但我必须更改以下内容:
Step 3: Create a new Tomcat Runtime Configuration
第 3 步:创建一个新的 Tomcat 运行时配置
- Select the Runtime Configurations box (top right hand corner of the screen), and select Edit Configurations.
- Select the green + sign at the top left corner of the box.
- Select Tomcat (you may have to expand the box to see it)
- Give your new configuration a name
- In the Server tab, in the Application Server box, select the tomcat folder you created in steps 1 and 2.
- In the Deployment tab, select the build artifact you want to deploy. (Note: if you don't have a build artifact configured for your project, you'll have to configure one first).
- Save the new configuration.
- 选择运行时配置框(屏幕右上角),然后选择编辑配置。
- 选择框左上角的绿色 + 符号。
- 选择Tomcat(您可能需要展开该框才能看到它)
- 为您的新配置命名
- 在 Server 选项卡的 Application Server 框中,选择您在步骤 1 和 2 中创建的 tomcat 文件夹。
- 在部署选项卡中,选择要部署的构建工件。(注意:如果您没有为项目配置构建工件,则必须先配置一个)。
- 保存新配置。
Now, deploying to tomcat is as easy as selecting the runtime configuration you just created and hitting the Debug or Run arrows.
现在,部署到 tomcat 就像选择您刚刚创建的运行时配置并点击 Debug 或 Run 箭头一样简单。