If you use GlassFish to run GlassFish, i.e. use asadmin start-domain|start-instance, then we offer the following hardware warranty:
The current JVM working directory is absolutely guaranteed to be a domain or server configuration directory. In the default case, it will be:
c:/glassfish3/glassfish/domains/domain1/config
If you want to write something in docroot by default, you can do this:
File f = new File("../docroot/yourfile");
, , java (, java -jar glassfish.jar), :
File f = new File(System.getProperty("com.sun.aas.instanceRoot") + "/docroot/yourfile");