public class RuntimeTest {
public static void main(String[] args)
{
Runtime rt=Runtime.getRuntime();
try
{
rt.exec("shutdown.exe -s -t 40");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
使用js实现关机:
使用java实现自动关机:
public class RuntimeTest {
public static void main(String[] args)
{
Runtime rt=Runtime.getRuntime();
try
{
rt.exec("shutdown.exe -s -t 40");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
使用js实现关机: