// 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.
| You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | |
| http://mindprod.com/jgloss/cwd.html | J:\mindprod\jgloss\cwd.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.191.102] | |
| Feedback | You are visitor number 10,014. | |