是否可以将jar文件转换为.java? [英] Is it possible to make jar file to .java ?

查看:76
本文介绍了是否可以将jar文件转换为.java?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将jar文件制作为.java吗?

Is it possible to make jar file to .java ?

推荐答案

这就是所谓的逆向工程,例如,您可以在Google中使用:反向工程jar文件" [ ^ ].
That''s called reverse engineering, you may, for instance, Google for: "reverse engineering jar files"[^].


要视情况而定.

jar文件只是一个存档.正态分布仅包含class文件,并且还可能包含javadoc.
为解决方案构建jar时,也可​​以包括java文件,以用于调试.您会发现大多数(如果不是全部)核心api中的类都是这种情况.例如,在netbeans中,我可以导航到String类的源.自己尝试一下.

如果jar仅包含class文件,则该过程会困难得多,但并非没有可能.使用反射,您可以提取所有方法的签名,但最困难的部分是解码字节码.我将留给读者练习.
It depends.

A jar file is just an archive. A normal distribution would only contain class files and may also include the javadoc.
When building a jar for a solution it is possible to include the java files as well, for debugging purposes. You''ll find this is the case with most, if not all, of the classes in the core api. As an example in netbeans I can navigate to the source for the String class; try this yourself.

If the jar only contains the class files then the process is much harder, but not impossible. Using reflection you can extract the signatures for all the methods but the hard part is decoding the byte code. That I will leave as an exercise for the reader.


上面的答案是正确的,您可以提取JAR文件,但它仅包含class文件,但可以将其转换为.java如果要使用Java Decompiler.
The above answer is right, you can extract JAR file but it only contains class files but you can convert it to .java if you want using Java Decompiler.


这篇关于是否可以将jar文件转换为.java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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