iceberg
iceberg

Reputation: 1961

How to set default parameters to jvm?

I'd like to know how I can pass parameters to JVM before it is started. For example,

I think I need to modify JVM timezone parameter.

I use eclipse with windows 7.

Upvotes: 8

Views: 24006

Answers (2)

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 136012

In Eclipse go to

Run As -> Run Configurations -> Arguments -> VM Arguments

and set required JMV argument, eg

-Duser.timezone=PST

you can get all timezone IDs available in JVM by running this test

for(String id : TimeZone.getAvailableIDs()) {
    System.out.println(id);
}

output

Etc/GMT+12
Etc/GMT+11
Pacific/Midway
Pacific/Niue
Pacific/Pago_Pago
Pacific/Samoa
....

Upvotes: 11

Nikolay Kuznetsov
Nikolay Kuznetsov

Reputation: 9579

JVM parameters are specified in command line with -D

java -Dfile.encoding=utf-8 -jar myApp.jar

In your case use -Duser.timezone

How to set a JVM TimeZone Properly

Upvotes: 4

Related Questions