Shutdown Remote Computer in Java- Cannot initiate shutdown but no errors

拈花ヽ惹草 提交于 2019-12-06 12:56:08

Try

Runtime.getRuntime().exec("shutdown -s");

Edited part:

Use this.

shutdown /s /m <Computer_Name> To shutdown a remote PC

It probably does not work because the VM you are running the Java class with is started from a user that does not have shutdown rights. The process would inherit these access restrictions and therefore no be allowed to shut down.

Arguably thats a good thing..

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!