更改 JAR 文件中的图像

Change an image in a JAR file

我有一个 jar 文件,它在 运行 时显示图像文件。现在我想更改源代码,以便它显示不同的图像。这个过程怎么做?

使用Java Decompiler and decompile the jar file to java classes and edit the source, here take a look at this How do I "decompile" Java class files? or here try this online decompiler

Jar 文件只是内部包含已定义对象的 zip 文件。例如,可能有一个 META-INF 文件夹或类似的东西。

也许你应该简单地拿起你的 jar,用一些压缩工具打开它,然后用你的图像替换里面的图像资源。这样您就不需要编辑任何来源。

如果您遇到问题,您的 zip 工具可能是这些问题的根源。在这种情况下,您应该尝试使用程序 jar 来解包和重新打包您的 jar 文件。 jar 包含在任何 JDK.