IDEAJad (683) on Linux - HOWTO

Hi

if you try IdeaJad on linux, you will find it doesn't work.

First trivial thing is that the zip doesn't contain the jad executable
marked as such. (I don't know if creating a zip with the x attribute is
possible in windows). you need to chmod +x it

The second more serious thing is that it comes up with a dialog
complaining it can't decompile.

To debug it, I found necessary to add some debug in the
Jad.decompile(...) method.
Hendrik please consider adding a debug option in code ;)

as the returned stream is unused, just copy the process out to the
parent system out/err. if you plan to use the stream in a next version,
maybe use a TeeStream whose second destination (System.out/err is used
on debug active ?).

public InputStream decompile(JadOptions options, String files)
throws IOException, InterruptedException {
String _command = execPath + options.toString() + " " + files;
System.out.println(_command);
Process p = Runtime.getRuntime().exec(_command);
ByteArrayOutputStream out = new ByteArrayOutputStream();
new StreamPumper(p.getErrorStream(), System.err).start();
new StreamPumper(p.getInputStream(), System.out).start();
p.waitFor();
return new ByteArrayInputStream(out.toByteArray());
}


this way it complains about not finding the class file

the solution is pretty simple: the quotes used to enclose the class file
and the directory are NOT enjoyed by JAD.

the same command works fine if pasted in a shell, but when Runtime.exec
runs, there is no shell to parse the command line.

So, if the method is changed to

public InputStream decompile(JadOptions options, String files)
throws IOException, InterruptedException {
String _command = execPath + options.toString() + " " + files;
_command = _command.replace('"',' ');
System.out.println(_command);
Process p = Runtime.getRuntime().exec(_command);
ByteArrayOutputStream out = new ByteArrayOutputStream();
new StreamPumper(p.getErrorStream(), System.err).start();
new StreamPumper(p.getInputStream(), System.out).start();
p.waitFor();
return new ByteArrayInputStream(out.toByteArray());
}

it works well on linux.
I will uplaod a pathced jar on the wiki, hoping that the next version be
will be linux friendly.

thanks for a great plugin, anyway!

Edo

0

请先登录再写评论。