tags:

views:

233

answers:

2

I have been moving my Java projects from Jdeveloper over to Eclipse whenever I have to go back and make a change (I only work with Java projects sparingly).

Everytime I try to create a project in Eclipse (3.3.2) I spend quite some time trying to figure out the proper way to configure the source directories in the Java build path dialog.

The biggest problem I'm having is getting the source directories to match up with the package specified in the source files. For Example my project looks like this:

MyProject
  DevelopmentBuilds
  MainSRC

The MainSRC directory is also the "Root" package so my classes would be defined as:

package MainSRC.Sub1;

If I set my included directory to blank, the files compile but with many errors because the Packages are not in the right place.

How do I tell eclipse to start at MainSRC for the compilation rather than the children of MainSRC?

Or, should I the path up with one src folder with MainSRC as subfolder?

I basically don't understand how this works.

+1  A: 

You would need to set the source directory to the root MyProject directory. You would have to tell Eclipse to exclude the other directories (such as DevelopmentBuilds) as they are not source code.

You might find you're better off conforming to Eclipse's expectations and creating a source folder which contains your main package folder.

Jeremy Stein
+1  A: 

Hi,

you need to set MainSRC as a 'Source Folder'.

Apparently, you project root are set as Source Folder.

Enter in project properties: . Right click over your Project root, and select Properties . Choose Java Build Path . Remove all source folders . Click 'Add Folder' . Select 'MainSRC' . Click Ok and Ok

Now, your MainSRC are a Source Folder. Some error occurs inside source files. For agile process, right click over package 'Sub1', and press F2. Rename your package for a new, then all your source files will be put in the correct new package.

[]'s,

And Past

apast
A good solution is adapt your path to minimal default eclipse configuration.The default source and build path are:. src: for source failes. bin: for binary filesYou can change all configuration. But, start from the simple case. Create a new Java Project into Eclipse workspace and learn step by step Eclipse Build Path. After all, you will see that its simplicity!
apast