eclipse Tomcat 临时目录位置是如何定义的?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2837972/
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-10 19:24:03  来源:igfitidea点击:

How is the Tomcat temp directory location defined?

eclipsetomcatdirectoryliferaytemp

提问by sdoca

I am running Tomcat bundled with Liferay5.2.3 and use Eclipse 3.5 (Galileo) as my IDE. I set up my Tomcat server in Eclipse as per this blog entry: http://www.jroller.com/holy/entry/developing_portlets_for_liferay_in. If I start Tomcat via the Eclipse server config, Liferay/Tomcat uses my C:\Documents and Settings\user\Local Settings\Temp\ directory. However, if I start Tomcat directly using the startup.bat script, Liferay/Tomcat uses the Tomcat temp directory. I can't figure out if Eclipse, Liferay or Tomcat is deciding which temp directory to use or how to change it. I would prefer to use the Tomcat temp directory.

我正在运行与 Liferay5.2.3 捆绑在一起的 Tomcat,并使用 Eclipse 3.5 (Galileo) 作为我的 IDE。我按照这个博客条目在 Eclipse 中设置了我的 Tomcat 服务器:http: //www.jroller.com/holy/entry/developing_portlets_for_liferay_in。如果我通过 Eclipse 服务器配置启动 Tomcat,Liferay/Tomcat 使用我的 C:\Documents and Settings\user\Local Settings\Temp\ 目录。但是,如果我直接使用 startup.bat 脚本启动 Tomcat,Liferay/Tomcat 将使用 Tomcat temp 目录。我不知道 Eclipse、Liferay 还是 Tomcat 正在决定使用哪个临时目录或如何更改它。我更喜欢使用 Tomcat 临时目录。

I have this issue with both the Lifera/Tomcat bundles 5.5 and 6.0 (liferay-portal-tomcat-6.0-5.2.3.zip and liferay-portal-tomcat-5.5-5.2.3.zip).

Liferay/Tomcat 捆绑包 5.5 和 6.0(liferay-portal-tomcat-6.0-5.2.3.zip 和 liferay-portal-tomcat-5.5-5.2.3.zip)都有这个问题。

Anybody have any clues?

有人有任何线索吗?

回答by dpinya

When you start Tomcat with catalina.sh (or catalina.bat), the temp directory is set with the CATALINA_TMPDIR variable:

当您使用 catalina.sh(或 catalina.bat)启动 Tomcat 时,临时目录设置为 CATALINA_TMPDIR 变量:

if [ -z "$CATALINA_TMPDIR" ] ; then
# Define the java.io.tmpdir to use for Catalina
    CATALINA_TMPDIR="$CATALINA_BASE"/temp
fi

Also you can pass below as VM argument while starting Tomcat in Eclipse to use it as temp directory.

您也可以在 Eclipse 中启动 Tomcat 时将其作为 VM 参数传递,以将其用作临时目录。

-Djava.io.tmpdir="C:\Program Files\liferay-portal-5.2.3-tomcat-6.0\tomcat-6.0.18\temp"

回答by sdoca

Although I still don't know where/how Tomcat determines where the default temp directory should be, nor do I know why Eclipse sets it to something different, I have found out that you can set the temp directory via a VM argument when starting Tomcat in Eclipse:

虽然我仍然不知道 Tomcat 在哪里/如何确定默认临时目录应该在哪里,也不知道为什么 Eclipse 将它设置为不同的东西,但我发现您可以在启动 Tomcat 时通过 VM 参数设置临时目录在 Eclipse 中:

-Djava.io.tmpdir="C:\Program Files\liferay-portal-5.2.3-tomcat-6.0\tomcat-6.0.18\temp"

-Djava.io.tmpdir="C:\Program Files\liferay-portal-5.2.3-tomcat-6.0\tomcat-6.0.18\temp"

回答by Narendra Shah

You can find the following folder structure in your workspace:

您可以在工作区中找到以下文件夹结构:

.metadata.plugins\org.eclipse.wst.server.core\tmp0\

Here you will find the folder which is attached with tomcat in eclipse.

在这里可以找到eclipse中tomcat附带的文件夹。