I have servlet deployed in JBoss. I want to read/write data into a text file based on the client input. Where should this text file be put in the JBoss directory structure?
There the /data
directory is for.
Its absolute path is available by the jboss.server.data.dir
system property.
File dataDir = new File(System.getProperty("jboss.server.data.dir"));
File yourFile = new File(dataDir, "filename.ext");
// ...
Note that you're this way tight-coupling the web application code to a specific server. If you ever want to change servers, keep in mind to change the above code as well to whatever the new server supports (or not).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With