反编译&从jar重新编译单个文件 [英] Decompile & recompile single file from jar

查看:126
本文介绍了反编译&从jar重新编译单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题已在评论的帮助下得到解决:

This problem has been solved witht he help of the comments:

有必要重新编译具有正确目标版本的java。在我的情况下 javac -source 1.3 -target 1.3 而不是简单的 javac 就行了。

It was necessary to recompile the java with the correct target version. In my case javac -source 1.3 -target 1.3 instead of simply javac did the trick.

问题描述:

我有一个编译的.jar java程序,其中单个url字符串需要被修改。使用JD我能够反编译代码并进行更改。

I have a compiled .jar java program in which a single url string needs to be modified. Using JD I was able to decompile the code and make the changes.

因为我想避免重新编译整个项目,我认为我可以简单地重新编译单个。 java文件我修改成.class并用它替换原始文件。

As I would like to avoid having to recompile the entire project I thought I could simply recompile the single .java file I modified into a .class and replace the original with it.

然而,重新包装jar之后,程序确实启动但是使用代码的功能我修改后表现不正常。

However, after repackaging the jar, the program does start but the functionality making use of the code I modified behaves erratically.

在日志中我找到:

E EventDispatchThreadExceptionHandler:Unhandled exception occurred during event dispatching.::
java.util.MissingResourceException: Can't find bundle for base name com.myCompany.mySoftware.resources.ModuleResources, locale en_US
       at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:842)

ModuleResources.java是我修改过的文件...

ModuleResources.java is the file I modified...

问题分析:


  1. 重新包装不是 故障:如果我提取并重新打包原始jar,一切正常。

  2. 我的修改同样似乎不是问题:当我重新编译JD反编译的java文件并使用结果时用于重新打包的类文件,我得到了同样的失败。

我反编译了重新打包的jar文件并将其与原始jar的反编译进行了比较file:在我修改过的文件中(至少)代码看起来是相同的但是JD显示了不同的行号。这可以暗示这个问题吗?

I decompiled the repackaged jar file and compared it with the decompilation of the original jar file: In the file I modified (at least) the code seems to be identical BUT JD shows different line numbers. Could that hint at the problem?

非常感谢任何帮助。

非常感谢!

推荐答案


当我重新编译JD反编译的java文件并使用生成的类文件进行重新打包时,我得到了同样的失败

when I recompile the JD-decompiled java file and use the resulting class file for repackaging, I get the same failure

这似乎指向JD。当您重新编译JD反编译的java文件时,是否可以将结果与原始的 .class 文件进行比较(例如,通过反汇编并比较结果)?如果它们的实质不同,那将证明JD有过错的理论;如果他们不这样做,则问题出在其他地方。

This seems to point the finger at JD. When you recompile the JD-decompiled java file, can you compare the result with the original .class file (for example, by disassembling both and comparing the result)? If they differ in substance, that'll lend credence to the theory that JD is at fault; if they don't, then the problem lies elsewhere.

这篇关于反编译&从jar重新编译单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆