-1

I am trying to execute JAD decompiler on class file from code:

Process p = Runtime.getRuntime().exec("c:\\1\\jad.exe c:\\1\\EIn.class");
//All paths are correct, "c:\\1\\jad.exe c:\\1\\EIn.class" wotks when I run it in cmd

When I debug i don't get any errors, debugger moves to the next line...

if I put:

int res = p.waitFor(); 

It just hangs.

Update:

BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String str = null;
while ((str = in.readLine()) != null) { //Stucks here
}
markiz
  • 2,164
  • 6
  • 34
  • 47

3 Answers3

1

Is the jad decompiler waiting on input from you via stdin?

To see the errors that you are getting, consume the getOutputStream and getErrorStream to see what the decompiler is writing out.

You can use the ProcessBuilder class to make redirecting streams a little more pleasant.

Jeff Foster
  • 43,770
  • 11
  • 86
  • 103
0
public static void main(String[] args) throws Exception {

    String[] cmd = { "c:\\1\\jad.exe", "-c:\\1\\EIn.class" };
    Process p = Runtime.getRuntime().exec(cmd);
    p.waitFor();
}
Morteza Adi
  • 2,413
  • 2
  • 22
  • 37
0

This is a TRAP in Java ,please just have a look at this page,you will get more than you wanna!

Kevin
  • 781
  • 1
  • 9
  • 18