如何将默认参数设置为jvm?

ice*_*erg 6 java windows set parameter-passing jvm-arguments

我想知道如何在启动之前将参数传递给JVM.例如,

我想我需要修改JVM时区参数.

我在Windows 7中使用eclipse.

Evg*_*eev 9

在Eclipse中去

Run As -> Run Configurations -> Arguments -> VM Arguments
Run Code Online (Sandbox Code Playgroud)

并设置所需的JMV参数,例如

-Duser.timezone=PST
Run Code Online (Sandbox Code Playgroud)

您可以通过运行此测试获取JVM中可用的所有时区ID

for(String id : TimeZone.getAvailableIDs()) {
    System.out.println(id);
}
Run Code Online (Sandbox Code Playgroud)

产量

Etc/GMT+12
Etc/GMT+11
Pacific/Midway
Pacific/Niue
Pacific/Pago_Pago
Pacific/Samoa
....
Run Code Online (Sandbox Code Playgroud)