How to pass Properties to jar from Powershell?

前端 未结 3 1446
一整个雨季
一整个雨季 2020-12-06 09:58

I\'ve been using Powershell-1.0 for command line needs for a while, instead of cmd.exe. Unfortunately, there are still some caveats when using Java. I need to pass a propert

3条回答
  •  囚心锁ツ
    2020-12-06 10:35

    Take a look at my answer to this question. Note how you can use echoargs.exe to diagnose these sort of problems. Most likely the fix would be to quote the parameter e.g.:

    java -jar "-Duser.language=en" any.jar
    

    You can test that using echoargs (from PowerShell Community Extensions):

    echoargs -jar "-Duser.language=en" any.jar
    Arg 0 is <-jar>
    Arg 1 is <-Duser.language=en>
    Arg 2 is 
    

提交回复
热议问题