Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 274
iceberg Avatar asked Feb 01 '13 08:02

iceberg


People also ask

How do you set JVM arguments?

-- Go to the Eclipse Window > preferences, in "Java > Installed JREs". -- Copy the current default JRE with a new name, for example myJRE. -- Select the new JRE and click on the "Edit" button. -- In the "Edit JRE" dialog, add your JVM arguments in the "Default VM Arguments" field.

How do I change JVM settings?

Configuring JVM OptionsAccess the Server Manager, and choose the Java tab. Click JVM Options and make the necessary changes. Click OK.

Where should I put JVM parameter?

To add JVM parameters, choose New . The property is added to Custom parameters . The actual parameters used by a running JVM can be found in the development trace file of the corresponding server process. This results in parameter: "-agentlib:myagent=port=12345,dir=C:/Mydir" .


2 Answers

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
....
like image 75
Evgeniy Dorofeev Avatar answered Oct 07 '22 14:10

Evgeniy Dorofeev


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

like image 21
Nikolay Kuznetsov Avatar answered Oct 07 '22 15:10

Nikolay Kuznetsov