0

Can you please tell what is significance of "java.io.tmp" directory?

I noticed this directory is created under webapps folder in my tomcat.

Thanks!

B Chawla
  • 574
  • 1
  • 8
  • 17
  • If you have a directory called "java.io.tmp" under your webapps folder when you run Tomcat, then something is very wrong: you have some code that is stupidly creating that directory instead of using the `java.io.tmp` *system property* that points to a temporary directory. – Christopher Schultz Oct 14 '12 at 00:03

2 Answers2

0

It is not directory, it is property points to a directory to be used as temp folder(directory happens to have same name as property is a tomcat decision). When you want to create temporary file, this property is used as the location for the file. Some example

 File tempFile = File.createTempFile("pattern", ".suffix");
 tempFile.deleteOnExit();

JVM by default copies the value from TMP/TEMP environment variable. The value can be set when JVM starts. Tomcat sets this for rest of the application to use.

Related : Environment variable to control java.io.tmpdir?

Community
  • 1
  • 1
Jayan
  • 18,003
  • 15
  • 89
  • 143
0

The name itself is a great clue. Its java.IO.TMP, which common sense would tell us is about temporary ios. Since the java.io package is about files then it probably adds up this is a path to store temporary files.

mP.
  • 18,002
  • 10
  • 71
  • 105