如何将所有 .class 文件从 .jar 文件转换为 .java 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37726712/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 02:44:03  来源:igfitidea点击:

How to convert all .class files into .java file from a .jar file

javajarexecutable-jar.class-file

提问by Govind Gupta

I have a .jar file and When I extract it, It gives me all the .class files present in that jar file.

我有一个 .jar 文件,当我提取它时,它给了我该 jar 文件中存在的所有 .class 文件。

I have decompiled all the .class files using http://jd.benow.ca/tool but i want that all the .class files should save into .java files.

我已经使用http://jd.benow.ca/工具反编译了所有 .class 文件,但我希望所有 .class 文件都应该保存到 .java 文件中。

Right now i can see only the code but extension is not converting to .java.

现在我只能看到代码,但扩展名没有转换为 .java。

Anybody Please help me in this.

任何人请帮助我。

采纳答案by Hosseini

you can use javadecompilersand its works perfectly

您可以使用javadecompilers及其完美运行

enter image description here

在此处输入图片说明

and in the next step you decompile with Upload and Decompileand this page be showing

在下一步中,您反编译Upload and Decompile并显示此页面

enter image description here

在此处输入图片说明

and thats is just copythe packagefolder from the jarname.zipand pasteit in you project.

并且那是刚刚copypackage从文件夹jarname.zippaste它在你的项目。

i tested its work for me.

为我测试了它的工作

enter image description here

在此处输入图片说明

you can see this answerfor more.

您可以查看此答案以了解更多信息。

回答by JF Meier

jd-cmd

jd-cmd

https://github.com/kwart/jd-cmd

https://github.com/kwart/jd-cmd

works fine for decompiling. I used it to convert whole jars into source code. Look up the command line options for more details, e.g. --outputDirfor specifying a directory for the generated source code.

反编译工作正常。我用它来将整个 jars 转换为源代码。查看命令行选项以获取更多详细信息,例如--outputDir为生成的源代码指定目录。