使用 Jode 反编译*任何*类时遇到问题
我已经盯着这个问题几个小时了。任何帮助表示赞赏。
我编写了使用“嵌入式 jode jar 文件”中的 Jode 反编译器的代码。我想使用这个版本,因为它遵循 Lesser GNU 公共许可证。
Decompiler d = new Decompiler();
try {
FileWriter fw = new FileWriter("c:\\jode.txt");
d.setClassPath("C:\\mycode");
ProgressListener p = new ProgressListener() {
public void updateProgress(double arg0, String arg1) {
System.out.println("inside of progress listener with arg0 = " +arg0+ " and arg1 = " +arg1);
}
};
d.decompile("Test.class" , fw, p);
} catch (Exception ex) {
ex.printStackTrace();
}
我总是得到:
Exception in thread "main" java.lang.NoClassDefFoundError: Test.class
at jode.bytecode.ClassInfo.loadInfo(ClassInfo.java:620)
at jode.decompiler.ClassAnalyzer.<init>(ClassAnalyzer.java:86)
at jode.decompiler.ClassAnalyzer.<init>(ClassAnalyzer.java:123)
at jode.decompiler.Decompiler.decompile(Decompiler.java:191)
at testdecompiler.Main.main(Main.java:45)
如果我使用
jode.decompiler.Main.decompile(...)
东西可以工作 - 但我不能使用这个类文件,因为它驻留在仅是 GPL 的 jode.jar 中。
I've been staring at this issue for hours now. Any help is appreciated.
I wrote code that uses the Jode decompiler from the "embedded jode jar file". I want to use this version because it is under the Lesser GNU Public License.
Decompiler d = new Decompiler();
try {
FileWriter fw = new FileWriter("c:\\jode.txt");
d.setClassPath("C:\\mycode");
ProgressListener p = new ProgressListener() {
public void updateProgress(double arg0, String arg1) {
System.out.println("inside of progress listener with arg0 = " +arg0+ " and arg1 = " +arg1);
}
};
d.decompile("Test.class" , fw, p);
} catch (Exception ex) {
ex.printStackTrace();
}
and I always get :
Exception in thread "main" java.lang.NoClassDefFoundError: Test.class
at jode.bytecode.ClassInfo.loadInfo(ClassInfo.java:620)
at jode.decompiler.ClassAnalyzer.<init>(ClassAnalyzer.java:86)
at jode.decompiler.ClassAnalyzer.<init>(ClassAnalyzer.java:123)
at jode.decompiler.Decompiler.decompile(Decompiler.java:191)
at testdecompiler.Main.main(Main.java:45)
If I use
jode.decompiler.Main.decompile(...)
things work - but I can't use this class file because it resides in the jode.jar that is only GPL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我能够使用其网站上提供的所有不同二进制版本的 jode 重现该问题。当我使用 svn 的主线构建新版本的 jode 时,它工作得很好。我还在一个 jode 论坛中看到了一个条目,其中一位用户抱怨 NoClassDefFound 问题。他的情况听起来略有不同,但 jode 开发人员建议他使用 svn 的主线而不是预构建的二进制文件。
I was able to reproduce the problem with all of the different binary versions of jode that are available from their web site. When I built a new version of jode using the mainline from svn, it worked fine. I also saw an entry in one of the jode forums where a user was complaining about the NoClassDefFound problem. His case sounded slightly different, but the jode developer suggested that he use the mainline from svn instead of the prebuild binary.
这个类路径对我来说看起来非常短。
This classpath looks awfully short to me.
这是一个猜测,因为我不喜欢反编译类,但我认为你应该使用
而不是你现在使用的。这可能类似于
没有“class”后缀。
This is a guess, as i don't fancy myself with decompiling classes, but i think that u should use
instead of what u are using now. This could be similar to
without the "class" suffix.
更新:我最初的假设是错误的,而且糟糕的是,据人工智能所见,原始的异常/消息被丢弃了。 JODE 失败的代码如下所示:
由于必须抛出 IOException 才能获取 NoClassDefFound,因此请检查有关 IO 子系统的任何内容,例如 file.encoding。我想你应该修补 JODE 以获取详细的错误消息或调试到这一点。
Update: My original assumption was wrong, and to bad, the original exception/ message is thrown away, as far a i can see. The code where JODE fails looks like this:
Since an IOException has to be thrown to get the NoClassDefFound, check anything regarding your IO subsytsem, e.g. the file.encoding. I guess you should patch JODE to get the detailed error message or debug to this point.