Of course; I was trying to get a thread dump using jstack here. You would need to change the command that Runtime.exec() executes to your liking.
Process threadDump=Runtime.getRuntime().exec("jstack -l "+pid);
BufferedReader br=new BufferedReader(new InputStreamReader(threadDump.getInputStream()));
//Do whatever you want