Can you set the current running directory from the java command line?

user538442 picture user538442 · Dec 14, 2010 · Viewed 32.4k times · Source

I am running a Java application from the command line. Can I specify a command line argument to set the current running directory to something other than where the application is actually going to run?

Answer

Datta Rooyikar picture Datta Rooyikar · Mar 2, 2012

There is a JVM argument -Duser.dir which can be used to set working directory for JVM.