2 Replies Latest reply: Feb 6, 2007 10:04 PM by 796440 RSS

    Changing system date

    807606
      I want t change the system time and date of my computer using java application developed using
      JFrame
      .
      Ihave tried it by creating a batch file.
      Has any one some more better solution than this?
      Please reply.
        • 1. Re: Changing system date
          800351
          Use hwclock command from Linux, or its equivalent on other platforms.
          Java proper, who is a good citizen of the system, usually does not do arbitrary(rude) low-level manipulation.
          • 2. Re: Changing system date
            796440
            You can't change the system date with pure Java. You'll have to use JNI or invoke an external program with Runtime.exec.

            Even if you could do it with Java, you wouldn't "use" JFrame to do it. You might have a button in the JFrame whose listener invokes a method that would do it, but to think of that as "using JFrame to change the system date" is do ignore the division of responsiblity that is critical to any well-designed program.