What's the difference between program arguments and VM arguments?

前端 未结 5 1943
忘了有多久
忘了有多久 2021-01-31 03:15

I found only when I put -Dcontext=web into VM arguments, the value can be read by System.getproperty method. I am wondering what\'s the difference betw

5条回答
  •  别那么骄傲
    2021-01-31 03:17

    Program arguments are arguments passed to your program and available in the args array of your main method

     public static void main(String[] args)
    

    VM arguments are passed to the virtual machine and are designed to instruct the VM to do something. You can do things like control the heap size, etc. They can be accessed by your program via a call to System.getProperty() as you described.

提交回复
热议问题