Eclipse:如何反编译jar并将其作为项目加载? [英] Eclipse: How Do I decompile jar and load it as a project?

查看:302
本文介绍了Eclipse:如何反编译jar并将其作为项目加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在jar中反编译jar并将其作为项目加载,以便修改代码?

how can I decompile a jar and load it as a project in my Eclipse so I can modify the code ?

我用google搜索jar反编译器。寻找指南或对使用经验的任何见解。

fyi I have googled jar decompiler. Looking for a guide or any insight on experiences with it.

推荐答案

除非您还拥有源代码(在JAR中或单独使用),否则您最好的方法是使用Java反编译器。取决于一开始的代码编译方式,这可能会生成与原始作者编写的内容明显不同的源代码(尽管功能上完全相同)。例如,某些优化程序选项可能会导致重写循环并删除局部变量。某些调试选项可能会导致局部变量的名称被删除,因此反编译器将不得不为它们发明(无意义的)名称,等等。

Unless you also have the source code (either in the JAR, or separately), then the best you can do is to use a Java decompiler. Depending on how the code was compiled in the first place, this might generate source code which is significantly different to what the original author wrote (although functionally identical, of course). For example, certain optimizer options could result in loops being re-written and local variables being removed. Certain debug options could result in the names of local variables being removed, so the decompiler will have to invent (meaningless) names for them, etc.

我还要质疑您要做的是合法的。通常,如果一个项目获得了修改的许可,那么它的源代码就可以使用,而您不需要做您打算做的事情。

I would also question whether what you want to do is legal. Generally, if a project is licensed for modification then its source code will be available and you won't need to do what you're proposing.

这篇关于Eclipse:如何反编译jar并将其作为项目加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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