简体   繁体   English

使用现有 Java 文件在 Eclipse 上创建新项目

[英]Create new project on Eclipse with existing Java files

I have to develop some Java application.我必须开发一些 Java 应用程序。 I have already the application structure, so I only have to modify java files to get what I want.我已经有了应用程序结构,所以我只需要修改 java 文件就可以得到我想要的。

I was compiling and running the Java application with java command.我正在使用 java 命令编译和运行 Java 应用程序。 However, I would like to create a project on Eclipse to be able to debug the code and make me easier the delevop work.但是,我想在 Eclipse 上创建一个项目,以便能够调试代码并使我更轻松地进行开发工作。

I tried to create a new Java project application and import the current Java files.我尝试创建一个新的 Java 项目应用程序并导入当前的 Java 文件。 However, I did it wrong and I don't know how to do that.但是,我做错了,我不知道该怎么做。 I have this directories estructure:我有这个目录结构:

root@vbox:/media/sf_shared/one_1.4.1# ls -d */
applications/  core/  data/  doc/  ee/  gui/  input/  interfaces/  lib/  movement/  report/  reports/  routing/  test/  toolkit/  ui/  wdm_settings/
root@mvbox:/media/sf_shared/one_1.4.1# ls core/
 Application.class           ConnectionListener.class     DTN2Manager.java        MessageListener.java                NetworkInterface.java   SimClock.class      UpdateListener.class
 Application.java            ConnectionListener.java      DTNHost.class           ModuleCommunicationBus.class        package.html            SimClock.java       UpdateListener.java
 ApplicationListener.class   Coord.class                  DTNHost.java            ModuleCommunicationBus.java         ParetoRNG.class         SimError.class      VBRConnection.class
 ApplicationListener.java    Coord.java                   DTNSim.class            ModuleCommunicationListener.class   ParetoRNG.java          SimError.java       VBRConnection.java
 CBRConnection.class         Debug.class                  DTNSim.java             ModuleCommunicationListener.java    Settings.class          SimScenario.class   World.class
 CBRConnection.java          Debug.java                   Message.class           MovementListener.class              SettingsError.class     SimScenario.java    World.java
 Connection.class            DTN2Manager.class            Message.java            MovementListener.java               SettingsError.java      Tuple.class
 Connection.java            'DTN2Manager$EIDHost.class'   MessageListener.class   NetworkInterface.class              Settings.java           Tuple.java

The main class is DTNSim.java.主要的 class 是 DTNSim.java。 There are also some config files in /media/sf_shared/one_1.4.1 directory. /media/sf_shared/one_1.4.1 目录中还有一些配置文件。

root@vbox:/media/sf_shared/one_1.4.1# ls *.txt
cluster_settings.txt  epidemic_settings.txt  LICENSE.txt            prophet_settings.txt  snw_comparison_settings.txt  WDM_conf_help.txt
default_settings.txt  HISTORY.txt            ping_app_settings.txt  README.txt            snw_settings.txt

I know that this is a very very noob question, but I really need help because I'm not developer.我知道这是一个非常非常菜鸟的问题,但我真的需要帮助,因为我不是开发人员。 How can I execute/modify/debug this application with Eclipse?如何使用 Eclipse 执行/修改/调试此应用程序?

I solved it.我解决了。 I just create a dir with the same name as a new Java project and eclipse recognize all java files and put it into a structure.我只是创建一个与新 Java 项目同名的目录,eclipse 识别所有 java 文件并将其放入结构中。

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

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