// Getting the CWD: Current Wording Directory // namely the current directory when java.exe was invoked. // It cannot be changed on the fly. final String cwd = new File( "." ).getCanonicalPath(); // Which may or may not be the same as: final String userDir = System.getProperty( "user.dir" );You can, of course, spawn a script to a command shell that would be able change the CWD inside itself, but not for the spawning Java app.
You can fake a CWD by maintaining your own CWD variable and expanding all relative filenames to absolute yourself.
The catch is, a Java program cannot dynamically change the CWD. The closest it could to that is spawn command scripts with embedded CD commands, that change on the local CWD within the script. It is odd that code implementing scripts can change the CWD, but not Java. I gather Java’s designers figured that you could not could on every possible OS (Operating System) permitting you to change the CWD. They could not thus safely built it in as a WORA (Write Once, Run Anywhere) feature.
This page is posted
Optional Replicator mirror
Your face IP:[18.104.22.168]
You are visitor number|