0

my web application project (JBoss AS) needs to read a file which resides outside of this project. For example, the file to be read is under /tmp/.

It looks like classes in the project can't access files under /tmp/. However, it can output to a file in /tmp/.

Is this normal? How to access /tmp/ directory in a Web application?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user697911
  • 10,043
  • 25
  • 95
  • 169

1 Answers1

0

Use java.io.tmpdir system property.

File tmpDir = new File(System.getProperty("java.io.tmpdir"));
//Use tmpDir to access files in tmp directory

Make sure there are unix permissions to read/write contents on tmp directory.

Mohit
  • 1,740
  • 1
  • 15
  • 19