什么是“src” Eclipse创建的目录? [英] What is "src" directory created by Eclipse?

查看:398
本文介绍了什么是“src” Eclipse创建的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • Eclipse创建了工作区文件夹。


  • 在这个文件夹中,我创建了一个游戏子文件夹(对于我的类,称为游戏)。我已经有该项目的.java文件(我在开始使用Eclipse之前在文本编辑器中写过)。


  • 我把所有的.java文件进入游戏目录。


  • 在Eclipse中,我从现有代码创建了一个新Java项目。


  • 徘徊在我身边的是Eclipse在我的游戏文件夹中创建一个src子文件夹。据我所知,src代表来源。但是我的来源(.java文件)是在游戏(通过构造)。



    我做错了什么? p>

    ADDED:



    我仍然无法解决问题。整整一天,我试图在Eclipse中使用现有的代码开始编程。这是非常复杂的。


    1. 我应该将现有项目导入到工作区还是应该从现有代码创建新的Java项目


    2. 我应该手动创建src文件夹并放入工作区吗?


    3. 我应该为软件包创建文件夹,否则Eclipse会自行执行?


    4. 我应该将.java文件复制到包目录之前或之后在Eclipse中创建一个项目?



    解决方案

    从eclipse工作区,然后使用函数:



    将现有项目导入工作区。





    这样可以让您的项目在源代码管理下,而Eclipse则自行管理其工作区(位于其他地方)。






    如果您只有来源想要),但没有Eclipse项目,所有你需要做的都是创建一个新的Java项目,并选择你的外部目录作为根目录的源。







    选择从现有来源创建项目




    1. I just installed Eclipse.

    2. The Eclipse created the "workspace" folder.

    3. In this folder I created a "game" sub-folder (for my class called "game"). I have already .java files for that project (I wrote them in a text editor before I started to use Eclipse).

    4. I put all my .java file into the "game" directory.

    5. In Eclipse I created a "New Java Project" from existing code.

    What wanders me is that the Eclipse create a "src" sub-folder into my "game" folder. As far as I understand "src" stands for "source". But my source (.java files) is in the "game" (by the construction).

    Am I doing something wrong?

    ADDED:

    I still cannot solve the problem. The whole day I am trying to start programming in Eclipse using existing code. It's incredibly complicated.

    1. Should I "Import Existing Project into Workspace" or should I "Create New Java Project from Existing code".

    2. Should I create "src" folder by hands and put in "workspace"?

    3. Should I create folders for packages or Eclipse will do it by itself?

    4. Should I copy my .java files to the package directory before or after I create a project in Eclipse?

    解决方案

    I would recommend keeping your sources separate from the eclipse workspace, and then use the function:

    Import existing project into workspace.

    That way you can keep your project under source control, while leaving Eclipse manage its workspace (located elsewhere) on its own.


    If you have only sources (anywhere you want), but no Eclipse project, all you need to do create a New Java project, and select your external directory as root directory for your sources.

    selecting "Create project from existing sources"

    这篇关于什么是“src” Eclipse创建的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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