Skip to main content
GameDev.net gamedev.net
🔒 Locked

Eclipse build path blues

Started by plywood Nov 17, 2010 at 7:47 AM 1 replies 1.4k views
Original Post
plywood
plywood
I am new to Eclipse and would like to set up a specific directory structure for my packages.

For example, for my project MyProj (which uses the default MyProj/src and MyProj/bin for I/O), I want the following structure:

com.myproj.core
com.myproj.core.utils
com.myproj.core.widget
com.myproj.testing
com.myproj.xml

So the 'core' package needs to have two "nested" packages named utils and widget. So I right-click my core package in Package Explorer, go to New >> Package. The dialog that pops up (New Java Package) has 2 textfields and a Browse button. One text field is for defining the Source Folder that the package will live in, the other field is for naming the package.

The default values for the Source Folder are MyProj/src, and the default name is already populated as "core". When I try to Browse for another package, it doesn't see anything below MyProj/src, and when I try to manually type in MyProj/src/core it gives me an error of Source folder is not on the build path.

I have double-checked to make sure that the core package is properly set up to be a top-level package in the src folder.

When I right-click MyProj and go to Build Path >> Configure Build Path, it won't let me add core to the build path, giving me an error of Cannot nest 'MyProj/src/core' ins... exclude 'core/' from MyProj/src

What is going on here? I just want to add utils and widget to core!?!?
BitMaster
BitMaster
Then simply tell it to create core.utils and core.widget.

Of course if you want the structure you outlined above you should tell it to create com.myproj.core.utils and com.myproj.core.widget and rename core to com.myproj.core.
OrangyTang
OrangyTang
You only need to specify one source directory, of MyProj/src. Within that you create packages and Eclipse will automatically create the subfolders within src/ for you.

Ie. 'Create Package' > leave directory as MyProj/src, type package name of 'com.myproj.core.utils'.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.