What is “src” directory created by Eclipse?

前端 未结 4 1476
清酒与你
清酒与你 2020-12-10 16:23
  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

相关标签:
4条回答
  • 2020-12-10 16:41

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

    Import existing project into workspace.

    alt text

    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.

    alt text

    alt text

    selecting "Create project from existing sources"

    alt text

    0 讨论(0)
  • 2020-12-10 16:41

    src is where Java IDEs (at least Eclipse and NetBeans) put the source files, it is pretty much standard, and the hierarchy of the folder inside it has to match your Java packages names.

    0 讨论(0)
  • 2020-12-10 16:42

    The convention for Java is that your Java files are arranged by namespace under a 'src' directory. So if your application's namespace is com.example.myGame your Java files will be located thus src\com\example\myGame\MyClass.java.

    0 讨论(0)
  • 2020-12-10 16:42

    Eclipse attempts to enforce a folder structure that is easy to maintain for all applications. You are not doing anything wrong. But you do have the option to select a different location for your source files but...everyone else expects your source code to be in src so why not.

    On the New Project screen you can choose the location where you want your source files or configure the default location if you are not happy with src.

    0 讨论(0)
提交回复
热议问题