TimeZone change - how to use TimeZone class

A

axrock

Hi,

Ok, firstly I know nothing about Java. But hoping somebody here has
got the skills to give me some pointers to fix a problem.

1. I use an application that is bundled with its own version of Java.
Problem is, the TimeZone is wrong and so to is the TZ Data.
2. I need to know how to change the TimeZone in the bundled version
from the command line. Because I then have to update about 50
computers. Command line would allow me to do it in one hit. TZupdater
is no good, as that only seems to update the system java. Not the java
our application uses.

Here is how the paths are defined.

/usr/local/javaapp/jvm/bin
java executable is in here

/usr/localjavaapp/jvm/lib
rt.jar is in here ( I notice a class in this file called TimeZone )
and figure this is the class I call to set it to what I want. Am I
correct?

I go to /usr/local/javaapp/jvm/bin and type:
../java -classpath /usr/local/javaapp/lib TimeZone=NZDT

However I get an error:
Exception in thread "main" java.lang.NoClassDefFoundError:
TimeZone=NZDT

My question is, what is the correct syntax to alter the TimeZone from
command line based on the above locations of the files?

Also, is this the way to do it, or is TimeZone class also in
another .jar file that I should be looking for?

Really appreciate your help, this is now taking me far to long to work
out and I am beginning to age trying to work it out myself.

Many thanks.
 
J

Joshua Cranmer

axrock said:
I go to /usr/local/javaapp/jvm/bin and type:
./java -classpath /usr/local/javaapp/lib TimeZone=NZDT

What do you think that will actually do?
My question is, what is the correct syntax to alter the TimeZone from
command line based on the above locations of the files?

Judging from the documentation on Sun's website, this should be the
correct thing to do:

cd /usr/local/javaapp/jvm/bin;
java -jar ~/tzupdater.jar -u
 
R

Roedy Green

Ok, firstly I know nothing about Java. But hoping somebody here has
got the skills to give me some pointers to fix a problem.

1. document your bug, with some proof of the anomaly (e.g. scanned
newspaper clipping) and submit it to Sun.

see http://mindprod.com/jgloss/bugs.html

These tables are a bear to keep accurate. The whole idea of DST is
insane. Trains ignore it. It causes too many anomalies. You can't
even do time sheets properly because of it.


2. You can create your own time zone objects to use is special
circumstances.

see http://mindprod.com/jgloss/timezone.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

"In the central North Pacific, plastic outweighs surface zooplankton 6 to 1."
~ Thomas M. Kostigen
 
R

Roedy Green

/usr/localjavaapp/jvm/lib

Don't screw with the standard libraries. There are many
implementations. They can too easily get updated on you undoing your
patch.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"In the central North Pacific, plastic outweighs surface zooplankton 6 to 1."
~ Thomas M. Kostigen
 
L

Lew

axrock said:
Roedy said:
1. document your bug, with some proof of the anomaly (e.g. scanned
newspaper clipping) and submit it to Sun.

It's not a bug that invoking 'java' on something not a Java class should give
that error message. That command does not follow the rules for invocation of
the 'java' command. Just for starters, '=' is not a valid character for a
class name.

As for
1. I use an application that is bundled with its own version of Java.
Problem is, the TimeZone is wrong and so to is the TZ Data [sic].

the OP does not tell us what version "its own version of Java" is. Possibly
it's an unpatched older version that predates some change in DST rules, or
it's got a time zone hard coded that doesn't match the OP's. It might not
even be a Sun Java, for all the OP has told us. There's just not enough
evidence in the OP's post to tell us that there's a bug in any version of
Java, much less Sun's.
These tables are a bear to keep accurate. The whole idea of DST is
insane. Trains ignore it. It causes too many anomalies. You can't
even do time sheets properly because of it.

I agree with you wholeheartedly.
 
R

Roedy Green

I agree with you wholeheartedly.

Prior to standard time, every town kept its own local time. You could
imagine the difficulty that caused once the telegraph and trains were
shrinking the world. So Sir Sandford Fleming invented standard time
zones. The boundaries have jags to suit the political realities but it
basically brought as much order to the chaos as you could reasonably
expect.

However, other people hate the order, and deliberately screwed it up
by inventing DST, with every jurisdiction deciding for itself on just
how much DST to have. We are working our way back slowly but surely
to the old system, that does not even have the uniformity of solar
synching.

The Internet is shrinking the world further. To get ahead of the
curve, perhaps we should set our watches to UTC, or at least he
alternate time function, such as I have on my desk clock.

You'd think, at least in airports clocks would also be in UTC as would
schedules. Once people got used to this, they would not be confused
by changing time zones.

It would be nice at least if there were a U.N. department of time that
maintained the official list of timezones and their DST rules. It is
a difficult job. It should not be duplicated.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Nature provides a free lunch, but only if we control our appetites."
~ William Ruckelshaus, America’s first head of the EPA
 
J

Joshua Cranmer

Roedy said:
The Internet is shrinking the world further. To get ahead of the
curve, perhaps we should set our watches to UTC, or at least he
alternate time function, such as I have on my desk clock.

As the world gets smaller (socioeconomically speaking, of course), it
stands to reason that time would be segregated into personal time--a
time of local convenience--and official time. Certainly, if
extraplanetary or extrasolar habitations become common, such a
distinction would probably have to be enforced. But even before then,
multinational corporations and projects already have to deal with wide
disparities of time zones.
You'd think, at least in airports clocks would also be in UTC as would
schedules. Once people got used to this, they would not be confused
by changing time zones.

+ said:
It would be nice at least if there were a U.N. department of time that
maintained the official list of timezones and their DST rules. It is
a difficult job. It should not be duplicated.

And the workers would be the Time Monks?
 
A

Arne Vajhøj

Roedy said:
Prior to standard time, every town kept its own local time. You could
imagine the difficulty that caused once the telegraph and trains were
shrinking the world. So Sir Sandford Fleming invented standard time
zones. The boundaries have jags to suit the political realities but it
basically brought as much order to the chaos as you could reasonably
expect.

However, other people hate the order, and deliberately screwed it up
by inventing DST, with every jurisdiction deciding for itself on just
how much DST to have. We are working our way back slowly but surely
to the old system, that does not even have the uniformity of solar
synching.

I don't think that is the motive.
The Internet is shrinking the world further. To get ahead of the
curve, perhaps we should set our watches to UTC, or at least he
alternate time function, such as I have on my desk clock.

All UTC does have some nice characteristics.
You'd think, at least in airports clocks would also be in UTC as would
schedules. Once people got used to this, they would not be confused
by changing time zones.

But I am not so sure about airport time. It is a critical
part of avoiding jet lag to start thinking in local time.

Arne
 
R

Roedy Green

However, other people hate the order, and deliberately screwed it up
by inventing DST, with every jurisdiction deciding for itself on just
how much DST to have. We are working our way back slowly but surely
to the old system, that does not even have the uniformity of solar
synching.

to get an idea what a nightmare DST has created have a look at
http://java.sun.com/javase/timezones/tzdata_versions.html

To make sense of time you need a database that not only tracks what
every micro jurisdiction is doing to meddle with time, but all they
have ever done.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Don’t worry about the world coming to an end today.
It is already tomorrow in Australia."
~ Charles Schulz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top