[英]How can I open a JAR for editing in Netbeans
我做了一個JAR文件。 很好 我一直在修改源代碼,卻忘記了所做的更改。 現在那行不通。 我可以以某種方式從Jar中拉出.java嗎?
JAR僅包含.class文件,這些文件是從.java源文件編譯而成的。 不幸的是,您無法編輯.class文件,並且期望從中得到有用的東西。
但是,這可能會起作用: JD GUI ,一個JAR反編譯器。
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文件。
解壓縮jar只會得到.class文件。 仍然可以嘗試使用Java反編譯器 ,它可以從.class文件生成源代碼
雖然不能保證結果100%
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.