就是运行一个java程序就重新启动计算机

解决方案 »

  1.   

    你如果知道dos下的重新启动计算机的命令,然后通过调用jni就可以实现
      

  2.   

    import java.io.IOException;public class TestNative {
      public static void main(String[] args) throws Exception {
      Runtime.getRuntime().exec("shutdown -r");
      } 
    }-t xx 还可以指定多少秒后重启
      

  3.   

    谢谢朋友们!!!xxedge(好钢用在刀刃上) :你的类我运行了一下报错。哪位朋友可以给我提供一个完整的例子程序。
      

  4.   

    如果你的操作系统是2000的话,你把XP下面的SHUTDOWN复制过来,然后
    import java.io.IOException;public class TestNative {
      public static void main(String[] args) throws Exception {
      Runtime.getRuntime().exec("cmd.exe shutdown.exe -r");
      } 
    }
      

  5.   

    你用btb368() 的方法拷贝一个shutdown试验一下吧,要不用C自己做一个shutdown.exe
    代码很简单的。Win32 API调用ExitWindowsEx