2 Replies Latest reply on Feb 7, 2007 4:04 AM by 796440

    Changing system date

      I want t change the system time and date of my computer using java application developed using
      Ihave tried it by creating a batch file.
      Has any one some more better solution than this?
      Please reply.
        • 1. Re: Changing system date
          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
            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.