Using Runtime.getRuntime().exec() in java

by 3/13/2006 10:36:00 AM 0 comments

Using Runtime.getRuntime().exec() in java

This is not well documented by Sun but if you make a call using Runtime.getRuntime().exec() you should always get a reference to the Process object that's returned. When you're done with the Process you should either:
  • Explicitly get and close the input, output and error streams for the Process, whether you've used them or not
  • or
  • Call Process.destroy()
If you don't make these calls you will leak resources. Once you start leaking resources you may start to see "IOException: Broken Pipe" errors

Brian Schlining

Developer

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

0 comments: