Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is the Tomcat temp directory location defined?

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.

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).

Anybody have any clues?

like image 337
sdoca Avatar asked May 14 '10 22:05

sdoca


People also ask

What is temp folder in Tomcat?

When you startup Tomcat, using startup. bat (Windows) or startup.sh , it calls catalina. bat / catalina.sh respectively. 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.

Where are Tomcat files located?

By default, these files are located at TOMCAT-HOME/conf/server. xml and TOMCAT-HOME/conf/web.

What is work directory in Tomcat directory structure?

The work directory, as its name suggests, is where Tomcat writes any files that it needs during run time, such as the generated servlet code for JSPs, the class files for the same after they are compiled, the serialized sessions during restarts or shutdowns (SESSIONS. ser).

Can we delete Tomcat temp folder?

Yes, the tomcat/temp directory is safe to delete when the server is stopped.


1 Answers

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

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.

-Djava.io.tmpdir="C:\Program Files\liferay-portal-5.2.3-tomcat-6.0\tomcat-6.0.18\temp"
like image 67
dpinya Avatar answered Sep 19 '22 09:09

dpinya