Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
01-21-2008, 12:36 PM #1
- Join Date
- Jan 2008
- Thanked 0 Times in 0 Posts
how to set system date using java
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 12:37 PM. Reason: forgot to say which os
01-22-2008, 06:23 AM #2
- Join Date
- Jun 2005
- 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.