Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I write to a directory outside the j2ee container?  RSS feed

 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want my servlet to write to the equivalent of C:\store, however, because I'm using Linux, I want to write to /store. I have tried adding
<virtual-directory virtual-path="/store" real-path="/store/" />
and
<virtual-directory virtual-path="/store" real-path="~//store/" />
and
<virtual-directory virtual-path="/store" real-path="/../../../../../store/" />
to {OC4J_HOME}/j2ee/home/application-deployments/myApp/myApp/orion-web.xml with no success. The webapp still tries to write to
{OC4J_HOME}/j2ee/home/store

Can I write outside the j2ee container?
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
Make sure to use the File class static fields separator and pathSeparator (or the char versions).
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can indeed, IF the application server allows it (many don't or can have file permissions outside the web application directory disallowed for security reasons).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!