我已经在这个问题上几个小时盯着现在。任何帮助表示赞赏。

我写一个使用反编译JODE从“嵌入JODE jar文件”的代码。我想用这个版本,因为它是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我不能使用这个类文件

有帮助吗?

解决方案

我能够与所有的都可以从他们的网站JODE的不同二进制版本的重现该问题。当我建立从SVN主线JODE的新版本,它工作得很好。我也看到了在JODE论坛,用户抱怨说,NoClassDefFound问题的一个条目。他的情况下响起略有不同,但JODE显影剂建议他使用主线从SVN代替预生成二进制的。

其他提示

d.setClassPath("C:\\mycode");

此类路径看起来非常短我。

这是一个猜测,因为我不喜欢自己有反编译的类,但我认为,美应使用

d.decompile("Test" , fw, p);

而不是什么ü使用现在的。这可能是类似于

Class.forName("ClassName")

没有 “类” 后缀。

更新:我最初的假设是错误的,不好的,原始异常/消息被扔掉,就一个,我可以看到。其中JODE失败的代码看起来是这样的:

 try {
      DataInputStream input = new DataInputStream
          (new BufferedInputStream
           (classpath.getFile(name.replace('.', '/') + ".class")));
        read(input, howMuch);            

  } catch (IOException ex) {
        String message = ex.getMessage();
      if ((howMuch & ~(FIELDS|METHODS|HIERARCHY
                       |INNERCLASSES|OUTERCLASSES)) != 0) {
          throw new NoClassDefFoundError(name);
        }

由于一个IOException有被抛出,以获得NoClassDefFound,检查对您的IO subsytsem,例如什么的的file.encoding。我想你应该修补JODE获得详细的错误信息或调试到这一点。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top