用Java实现的一个控制关机的程序

发表于:2007-06-22来源:作者:点击数: 标签:

   
  用stec.sfc.Win32包吧,还是方便些。stec.sfc.Win32包可在http://www.servertec.com/products/sfc/download.html下载
  如关机与重启
  关机:
  import stec.sfc.Win32.System;
  public class logoff
  {

  public static void main(String[] args)
  {
  try
  {
  System.logoff(true);
  }
  catch(Exception ex) {}
  }
  }
  
  如:重启
  import stec.sfc.Win32.System;
  
  public class reboot
  {
  public static void main(String[] args)
  {
  
  try
  {
  System.reboot(true);
  }
  catch(Exception ex) {}
  }
  }

原文转自:http://www.ltesting.net