请教如何在JAVA中修改系统时间

如题所述

java修改系统时间:1。windows环境下:Runtime.getRuntime().exec("cmd /c date 2013-05-06");//Windows 系统Runtime.getRuntime().exec("cmd /c time 22:35:00");//Windows 系统2.linux环境下:Runtime.getRuntime().exec(" sudo date -s 2013-05-06")//linux 系统为tomcat用户分配了权限Runtime.getRuntime().exec(" sudo date -s 22:25:00")//linux 系统为tomcat用户分配了权限
温馨提示:答案为网友推荐,仅供参考