1

I tried to use Runtime.getRuntime().exec(cmd) to run out jad app to decompile .class file. cmd = "../bin/jad Test.class" But I cannot get the output by this way:

Process p = Runtime.getRuntime().exec(jadCmd2);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
        System.out.println(line);
}

nothing output, can anyone tell?

1
  • must have misread the question, removed my answer to avoid any confusion... Commented Jul 3, 2012 at 8:30

1 Answer 1

4

I suspect you are getting an error. I suggest you print that out as well.

If you use ProcessBuilder you can combine the output and error so you only have one stream to read.

From http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

 ProcessBuilder pb =
   new ProcessBuilder("myCommand", "myArg1", "myArg2");
 pb.redirectErrorStream(true);
 Process p = pb.start();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.