制作 sy.bat 文件@echo off
java sy
@echo on

解决方案 »

  1.   

    这样!!@echo off
    java sy
    @echo on@echo off
    sy.bat这样做每次选 n 后是重新启动程序
      

  2.   

    addShutdownHook    //看看它的用法。public void addShutdownHook(Thread hook)
    Registers a new virtual-machine shutdown hook. 
    The Java virtual machine shuts down in response to two kinds of events: 
    The program exits normally, when the last non-daemon thread exits or when the exit (equivalently, System.exit) method is invoked, or The virtual machine is terminated in response to a user interrupt, such as typing ^C, or a system-wide event, such as user logoff or system shutdown.
      

  3.   

    http://expert.csdn.net/Expert/topic/2469/2469519.xml