Where is the "work" directory located for a Tomcat instance running in Eclipse?

Go to "Servers" window -> double click on your tomcat instance -> clik "Open launch configuration" -> go to "Arguments" tab.

Look for variable definition like this:

-Dcatalina.base="/Users/dirtyaffairs/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0"

The easiest way is most likely to ask a compiled JSP page about the source of the byte code.

From http://www.exampledepot.com/egs/java.lang/ClassOrigin.html:

// Get the location of this class
Class cls = this.getClass();
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc = cSource.getLocation();  // file:/c:/almanac14/examples/

Hopefully this helps. What is it you want to do?


You will find it in

projectworkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0

This is the default place where Eclipse 3.4 publishes the project. However, this can be changed by changing the settings in your 'Server' view.