Help me understand Eclipse Java Build Path

I have moved my Java projects from Jdeveloper to Eclipse whenever I needed to go back and make changes (I only work with Java projects sparingly).

Every time I try to create a project in Eclipse (3.3.2), I have spent quite a while figuring out how to properly set up the source directories in the Java Build Path dialog box.

The biggest problem I've encountered is getting the source directories to match the package listed in the source files. For example, my project looks like this:

MyProject
  DevelopmentBuilds
  MainSRC

      

The MainSRC directory is also a "Root" package, so my classes will be defined as:

package MainSRC.Sub1;

      

If I set my included directory to empty, the files compile but with a lot of errors because the packages are not in the right place.

How do I tell eclipse to start in MainSRC to compile and not children of MainSRC?

Or, should I have a single src folder path with MainSRC as a sub folder?

Basically I don't understand how it works.

+2


source to share


2 answers


you need to set MainSRC as "source folder".

Apparently you are creating the root as the source folder.

Enter in the project properties:, Right click on your project root and select Properties. .Select Java Build Path, Delete All Source Folders, Click Add Folder, Select MainSRC, Click Ok and Ok



Your MainSRC is now the source folder. Some error occurs in the source files. For an agile process, right-click above the Sub1 package and press F2. Rename your package to new, then all source files will be put into the correct new package.

[] 'from,

And the past

+2


source


You need to set the source directory to the root directory MyProject

. You have to tell Eclipse to exclude other directories (for example DevelopmentBuilds

) as they are not source code.



You might be better off meeting Eclipse's expectations and create a source folder containing your main folder.

+1


source







All Articles