4 Replies Latest reply: Jul 1, 2013 8:01 AM by BIJ001 RSS

    kill java vm with Runtime

    newbieRyan

      Hello All,

       

      I m trying implement something funny in my web site.

      what I would like to do is to let anyone shut down the server if someone send a message to the site.

      I tried the code below in a java se app and fedora. it did run, but didn't kill the java process.

      Could someone point out if I miss anything?

      Thank you.

       

       

       

      {code}

              String stopCmd = "ps -ef | grep java | xargs kill";
              System.out.println(stopCmd);
              Runtime rt = Runtime.getRuntime();
              rt.exec(stopCmd);    

      {/code}