简体   繁体   English

如何在Eclipse中将类链接到项目

[英]How to link classes to project in eclipse

I just extracted some classes from a jar file using a program JD GUI. 我只是使用程序JD GUI从jar文件中提取了一些类。 Everything is great when i open the classes manually in eclipse but i would like the classes already in the project to open declarations of the classes i extracted. 当我在eclipse中手动打开类时,一切都很好,但是我希望项目中已有的类打开我提取的类的声明。 For now i get 'Source not found' as project is linked to the jar file. 现在,由于项目链接到jar文件,因此我得到“找不到源”。

You have a few options. 您有几种选择。 For the first two, your sources will need to be in a ZIP or JAR file. 对于前两个,您的源将需要在ZIP或JAR文件中。 I believe JD GUI has an option to export all sources to a ZIP. 我相信JD GUI可以选择将所有源导出到ZIP。

  1. When you try to open a class that doesn't have a source attachment, there should be an 'Attach Source...' button that you can click on and attach the source. 当您尝试打开没有源附件的课程时,应该有一个“附加源...”按钮,您可以单击并附加源。

  2. You can find the jar you want to attach sources to in the Project/Package explorer, right-click on it, and select 'Properties'. 您可以在“项目/包”资源管理器中找到要将源附加到的jar,右键单击它,然后选择“属性”。 That will bring up a property dialog - select the 'Java Source Attachment' on the left-hand menu and then attach the source there. 这将打开一个属性对话框-在左侧菜单上选择“ Java Source Attachment”,然后在此处附加源。

  3. Perhaps the easiest - since you are using sources generated by JD GUI, why not just use the Eclipse plugin from the same author? 也许最简单-由于您使用的是JD GUI生成的源代码,为什么不只使用同一作者的Eclipse插件呢? I've used it, and it works quite well: http://java.decompiler.free.fr/?q=jdeclipse . 我已经使用过它,并且效果很好: http : //java.decompiler.free.fr/?q=jdeclipse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM