This discussion is archived
4 Replies Latest reply: Jul 1, 2013 6:01 AM by BIJ001 RSS

kill java vm with Runtime

newbieRyan Newbie
Currently Being Moderated

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.





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



  • Correct Answers - 10 points
  • Helpful Answers - 5 points