Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how to set system date using java

    hi all,

    i am parthu. i have doubt in java, it is possible to change or reset the system date using java language (i.e) while pressing the button i have to change or reset system date and time in windows xp.plz help me to solve this problem.
    Last edited by parthu2; 01-21-2008 at 11:37 AM. Reason: forgot to say which os

  • #2
    New Coder
    Join Date
    Jun 2005
    Posts
    32
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Look into using the Process class to execute a command you might use on the command line (DATE in your case). Small tutorial that you can use to get you started is at: http://java.sun.com/developer/JDCTec.../tt0304.html#1

    You'll probably have to run this command with administrator privileges...not too familiar with Windows.

    On a side note, if you use this approach, the example doesn't close any of the streams that were opened to read the output of the command issued. You should do this to avoid unwanted resource consumption.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •