A
A
Andrey Myvrenik2016-04-11 10:50:52
Java
Andrey Myvrenik, 2016-04-11 10:50:52

Where do services running in Tomcat/WildFly/Jetty containers save files?

Let's say a service needs to create some files at run time, whether it's just for its own needs or for a client to upload a file to the server. Where are these files usually saved? Hardcoding the path is clearly not the best idea, is it? In particular, this question is of interest in the context of a RESTEasy service, in case this changes anything.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Myvrenik, 2017-04-03
@gim0

The answer to this question is simple, you enter your own application parameter, which is supplied with the path to the directory at startup or through a separate config file.

E
Eugene, 2016-04-11
@zolt85

For temporary files, you can use the temp folder. EMNIP, tomcat starts by default with the java.io.tmpdir parameter, which points to the tmp folder in tomcat. You can get the path throughSystem.getProperty("java.io.tmpdir");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question