程序参数和VM参数有什么区别? [英] What's the difference between program arguments and VM arguments?

查看:423
本文介绍了程序参数和VM参数有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只有当我将 -Dcontext = web 放入VM参数时,我才发现该值可以通过 System.getproperty 方法。我想知道这两者之间有什么区别?

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 between those two?

推荐答案

程序参数是传递给程序的参数,可在 args 您的主要方法的数组

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参数传递给虚拟机,旨在指示VM执行某些操作。您可以像控制堆大小等一样的操作。您可以通过调用 System.getProperty()来访问程序。

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.

这篇关于程序参数和VM参数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆