View Full Version : how to set system date using java

01-21-2008, 12:36 PM
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.

01-22-2008, 06:23 AM
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/JDCTechTips/2003/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.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum