对重复参考的评论:为什么在被引用为重复的问题之前多年被问到时,这会被标记为重复?我也相信问题,细节和反应要比引用的问题好得多.
我已经做了很长一段时间的C++程序员,但我是Java的新手,也是Eclipse的新手.我想使用触摸图形"图形布局"代码来可视化我正在使用的一些数据.
此代码的组织方式如下:
./com ./com/touchgraph ./com/touchgraph/graphlayout ./com/touchgraph/graphlayout/Edge.java ./com/touchgraph/graphlayout/GLPanel.java ./com/touchgraph/graphlayout/graphelements ./com/touchgraph/graphlayout/graphelements/GESUtils.java ./com/touchgraph/graphlayout/graphelements/GraphEltSet.java ./com/touchgraph/graphlayout/graphelements/ImmutableGraphEltSet.java ./com/touchgraph/graphlayout/graphelements/Locality.java ./com/touchgraph/graphlayout/graphelements/TGForEachEdge.java ./com/touchgraph/graphlayout/graphelements/TGForEachNode.java ./com/touchgraph/graphlayout/graphelements/TGForEachNodePair.java ./com/touchgraph/graphlayout/graphelements/TGNodeQueue.java ./com/touchgraph/graphlayout/graphelements/VisibleLocality.java ./com/touchgraph/graphlayout/GraphLayoutApplet.java ./com/touchgraph/graphlayout/GraphListener.java ./com/touchgraph/graphlayout/interaction ./com/touchgraph/graphlayout/interaction/DragAddUI.java ./com/touchgraph/graphlayout/interaction/DragMultiselectUI.java ./com/touchgraph/graphlayout/interaction/DragNodeUI.java ./com/touchgraph/graphlayout/interaction/GLEditUI.java ./com/touchgraph/graphlayout/interaction/GLNavigateUI.java ./com/touchgraph/graphlayout/interaction/HVRotateDragUI.java ./com/touchgraph/graphlayout/interaction/HVScroll.java ./com/touchgraph/graphlayout/interaction/HyperScroll.java ./com/touchgraph/graphlayout/interaction/LocalityScroll.java ./com/touchgraph/graphlayout/interaction/RotateScroll.java ./com/touchgraph/graphlayout/interaction/TGAbstractClickUI.java ./com/touchgraph/graphlayout/interaction/TGAbstractDragUI.java ./com/touchgraph/graphlayout/interaction/TGAbstractMouseMotionUI.java ./com/touchgraph/graphlayout/interaction/TGAbstractMousePausedUI.java ./com/touchgraph/graphlayout/interaction/TGSelfDeactivatingUI.java ./com/touchgraph/graphlayout/interaction/TGUIManager.java ./com/touchgraph/graphlayout/interaction/TGUserInterface.java ./com/touchgraph/graphlayout/interaction/ZoomScroll.java ./com/touchgraph/graphlayout/LocalityUtils.java ./com/touchgraph/graphlayout/Node.java ./com/touchgraph/graphlayout/TGAbstractLens.java ./com/touchgraph/graphlayout/TGException.java ./com/touchgraph/graphlayout/TGLayout.java ./com/touchgraph/graphlayout/TGLensSet.java ./com/touchgraph/graphlayout/TGPaintListener.java ./com/touchgraph/graphlayout/TGPanel.java ./com/touchgraph/graphlayout/TGPoint2D.java ./com/touchgraph/graphlayout/TGScrollPane.java ./TG-APACHE-LICENSE.txt ./TGGL ReleaseNotes.txt ./TGGraphLayout.html ./TGGraphLayout.jar
如何在Eclipse中添加此项目并使其快速编译和运行?
在Eclipse中创建一个新的Java项目.这将创建一个src文件夹(包含您的源文件).
还要创建一个lib文件夹(名称并不重要,但它遵循标准约定).
将./com/*
文件夹复制到文件/src
夹中(您可以使用操作系统执行此操作,无需进行任何花哨的导入或Eclipse GUI中的任何操作).
将任何依赖项(jar
项目本身依赖的文件)复制到/lib
(请注意,这不应包括TGGL jar
- 感谢评论员Mike Deck指出我对OP帖子的误解!)
将其他TGGL内容复制到根项目文件夹(或专用于您需要在最终应用程序中分发的许可证的其他文件夹)
回到Eclipse,选择在步骤1中创建的项目,然后点击F5键(这将刷新Eclipse的文件夹树视图和实际内容.
/src
文件夹的内容将自动编译(类文件放在Eclipse创建项目时为您生成的/ bin文件中). 如果您有依赖项(在当前项目中没有,但为了完整性我会在此处包含它),编译将最初失败,因为您缺少jar files
项目类路径的依赖项.
最后,/lib
在Eclipse中打开文件夹,right click
在每个需要的位置jar file
选择Build Path->Add
构建路径.
这会将该特定jar添加到项目的类路径中.Eclipse将检测更改并自动编译先前失败的类,您现在应该有一个包含应用程序的Eclipse项目.
我想你必须通过file-> import wizard导入项目:
http://www.coderanch.com/t/419556/vc/Open-existing-project-Eclipse
这不是最后一步,但它将在你的路上开始.
我也感受到了你的痛苦 - 没有任何借口可以让你做一件简单的事情就像打开一个现有的项目一样困难.我真的希望Eclipse设计人员专注于使IDE更易于使用(我赞赏他们尝试不同方法的努力 - 但是,如果你正在倾听,Eclipse设计师请不要简单地复杂化).
这假设您的系统上安装了Eclipse和相应的JDK
打开Eclipse并通过指定空目录来创建新的Workspace.
通过选择Window - > Open Perspective ...确保您处于Java透视图中,选择Other ...然后选择Java
右键单击Package Explorer窗格中的任意位置,然后选择New - > Java Project
在打开的对话框中为项目命名,然后单击"从现有源包装项目"选项.
在步骤4中选择的选项下方的文本框中,指向您签出项目的根目录.这应该是包含"com"的目录
单击完成.对于此特定项目,您不需要为类路径执行任何其他设置,因为它仅依赖于属于Java SE API的类.
在菜单中去: - 文件 - 导入 - 作为过滤器中选择"现有项目到工作区" - 点击下一步 - 浏览到"选择根目录"项目目录 - 点击"完成"