Tomcat 7 中的 Tomcat/temp 目录是什么? [英] What is the Tomcat/temp directory in Tomcat 7?

查看:77
本文介绍了Tomcat 7 中的 Tomcat/temp 目录是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tomcat 7 的全新下载(我使用的是 7.0.19)包含一个包含单个文件safeToDelete.tmp"的temp"目录.这个目录是Tomcat用来做什么的,或者Tomcat用户(开发者)应该如何使用?

A fresh download of Tomcat 7 (I'm using 7.0.19) contains a 'temp' directory containing the single file, 'safeToDelete.tmp'. What is this directory used for by Tomcat or how is should be used by Tomcat users (developers)?

推荐答案

当您启动 Tomcat 时,使用 startup.bat (Windows) 或 startup.sh,它会调用catalina.bat/catalina.sh 分别.

When you startup Tomcat, using startup.bat (Windows) or startup.sh, it calls catalina.bat/catalina.sh respectively.

Catalina 然后需要设置一个临时目录.它通过将 CATALINA_TMPDIR 变量设置为 TOMCAT_HOME\temp 文件夹并将其分配给 java 系统环境变量作为 java.io.tmpdir 来实现.

Catalina then needs a temp directory to be set. It does this by setting the CATALINA_TMPDIR variable to TOMCAT_HOME\temp folder and assigns it to java system environment variable as java.io.tmpdir.

这是从catalina.bat复制的:

rem   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
rem                   the JVM should use (java.io.tmpdir).  Defaults to
rem                   %CATALINA_BASE%\temp.

其中 CATALINA_BASETOMCAT_HOME(如果使用 startup 脚本运行).

Where CATALINA_BASE is TOMCAT_HOME (if run using the startup script).

我们继续:

if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
set "CATALINA_TMPDIR=%CATALINA_BASE%\temp"

最后:

if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end

最后,java.io.tmpdir 指向 CATALINA_TMPDIR,其中 JVM 写入临时文件,包括基于磁盘的存储策略.

Finally, the java.io.tmpdir is pointed to the CATALINA_TMPDIR where the JVM write temporary files including disk-based storage policies.

这篇关于Tomcat 7 中的 Tomcat/temp 目录是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆