TimeZone change - how to use TimeZone class

Discussion in 'Java' started by axrock, Mar 20, 2009.

  1. axrock

    axrock Guest

    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.
    axrock, Mar 20, 2009
    #1
    1. Advertising

  2. axrock wrote:
    > 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

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
    Joshua Cranmer, Mar 20, 2009
    #2
    1. Advertising

  3. axrock

    Roedy Green Guest

    On Fri, 20 Mar 2009 14:36:58 -0700 (PDT), axrock
    <> wrote, quoted or indirectly quoted someone
    who said :

    >
    >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
    Roedy Green, Mar 21, 2009
    #3
  4. axrock

    Roedy Green Guest

    On Fri, 20 Mar 2009 14:36:58 -0700 (PDT), axrock
    <> wrote, quoted or indirectly quoted someone
    who said :

    >/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
    Roedy Green, Mar 21, 2009
    #4
  5. axrock

    Lew Guest

    axrock said:
    >> 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


    Roedy Green wrote:
    > 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.

    --
    Lew
    Lew, Mar 21, 2009
    #5
  6. axrock

    Roedy Green Guest

    On Fri, 20 Mar 2009 21:39:30 -0400, Lew <> wrote,
    quoted or indirectly quoted someone who said :

    >> 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.


    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
    Roedy Green, Mar 21, 2009
    #6
  7. Roedy Green wrote:
    > 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.


    +<however many votes I am entitled to give to a proposal>

    > 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?

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
    Joshua Cranmer, Mar 21, 2009
    #7
  8. axrock

    Arne Vajhøj Guest

    Roedy Green wrote:
    > 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
    Arne Vajhøj, Mar 21, 2009
    #8
  9. axrock

    Roedy Green Guest

    On Sat, 21 Mar 2009 14:44:49 -0700, Roedy Green
    <> wrote, quoted or indirectly quoted
    someone who said :

    >
    >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
    Roedy Green, Mar 25, 2009
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. marcie
    Replies:
    0
    Views:
    587
    marcie
    Apr 28, 2004
  2. Replies:
    0
    Views:
    2,850
  3. asaf
    Replies:
    3
    Views:
    6,151
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Sep 11, 2006
  4. Remco van 't Veer

    change default timezone

    Remco van 't Veer, Nov 8, 2005, in forum: Ruby
    Replies:
    3
    Views:
    297
    David N. Springer
    Nov 8, 2005
  5. Ami
    Replies:
    5
    Views:
    279
Loading...

Share This Page