What do you mean by working directory? The directory you mentioned is the instance configuration directory where logically all the configurations are stored at, but temporary files or compiled files don't go there.
What I mean by working directory is inside your program when your reference a file by relative path ./app/myapp/config in Weblogic that would translate in to absolute path of /domaindir/domain/app/myapp/config but in Glassfish it is /domaindir/domain/config/app/myapp/config
Using a relative PATH like what you were doing is not recommended because as you have seen, the result will vary between application servers.
To get the location you want, you can use the following variable from the system and prepend it to your file path:
If you really want to change the default, you can set the system variable for "user.dir"