如何在Netbeans中打开JAR进行编辑

时间:2015-05-24 10:12:23

标签: java jar

我制作了一个JAR文件。运行正常。我一直在修补消息来源,我忘记了所做的更改。现在这不起作用。我能以某种方式从罐子里拿出.java吗?

3 个答案:

答案 0 :(得分:1)

JAR只包含.class文件,这些文件是从.java源文件编译而来的。遗憾的是,您无法编辑.class文件,并期望从中获得任何有用的信息。

这可能有用:JD GUI,一个JAR反编译器。

答案 1 :(得分:0)

jar文件类似于zip文件,因为您可以提取内容。从oracle网站上提取命令行(你也可以使用像7zip这样的程序):

用于提取JAR文件内容的基本命令是:

jar xf  jar-file [archived-file(s)]

让我们看一下这个命令中的选项和参数:

The x option indicates that you want to extract files from the JAR archive.
The f options indicates that the JAR file from which files are to be extracted is specified on the command line, rather than through stdin.
The jar-file argument is the filename (or path and filename) of the JAR file from which to extract files.
archived-file(s) is an optional argument consisting of a space-separated list of the files to be extracted from the archive. If this argument is not present, the Jar tool will extract all the files in the archive.

注意:jar文件可以包含任何类型的文件,而不仅仅是.class文件。

答案 2 :(得分:0)

提取jar将只提供.class文件。您仍然可以尝试java decompilers,它可以从.class文件生成源

结果不是100%保证