Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

using %~dp0 in -D

tbee-JavaNetDec 14 2009 — edited Dec 19 2009
%~dp0 is a placeholder in DOS scripts for the current directory. I would like to pass that as a parameter to a Java application. I need to use this, because the user.dir system properties to not work correctly (there is no additional value in explaining exactly why here).

Anyhow, -Dxxx=%~dp0 works, as long as there is no space in the path.
-Dxxx="%~dp0" does not work and results in a:
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
Anyone got a suggestion on how to pass %~dp0 with spaces to java?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 16 2010
Added on Dec 14 2009
4 comments
464 views