java修改方法
发布时间: 2025-10-12 19:18:22
Ⅰ 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用户分配了权限
热点内容