• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set Environment variable to set -Duser.timezone property for JVM?

 
kunu patil
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to set -Duser.timezone property in Windows NT with a particular timezone. In Eclipse I could set it using Runtime confguration. The same I could do using argument to Java command. However, I want to do the same by using Environment Vto set -Duser.timezone property for JVM. Is it possible to do so? If yes, then how can I do that?

Appreciate your help.

Thanks in advance
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since with "Environment" you mean something that's part of your IDE (I'm guessing Eclipse) I'm moving this thread to our IDEs forum.
 
kunu patil
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob

By Environment I meant Environmental Variables..
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And by "environmental variables" you meant... what?
 
kunu patil
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean System Variables, which we set in Windows by - "Right Click on My Computer > System Properties> Advanced" ...For example, we set Classpath there...
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, okay. Then you pick a name -- let's call it JAVA_TIME_ZONE -- and create an environment variable whose value is "-Duser.timezone=whatever". Then at the command line, instead of doing

you do this instead:

Although I don't know why you would want to do that; it doesn't really help with any problem that I can see.
 
kunu patil
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul

Thanks for the reply.

Is there any way to use this environment variable without passing it as an argument to java command?
That is, If I set this environment variable as you suggested and then just run java program using-
, how will this program pick up value of the said environment variable?

I want to acheive this: Whenever any Java program runs on my machine it should use the timezone specified through the environment variable.

Thanks.
 
Akhil Kashyap
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kunu,

Can you please tell me how to set time zone for Eclipse.

I am using JDK 5 and Eclipse Galileo. Eclipse shows time as per GMT in console where as I am in IST. Windows is displaying time perfectly fine.


Thanks in advance.


Akhil Kashyap
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic