Issue
When I use Eclipse in Java development, it seems you can never make package name and folder structure different.
For example, if you create folder structure src/com/naishe/test
and create class under it, the package name will be com.naishe.test
, see:
Java Package Vs Folder-Structure? what is the difference
However, i've seen a project example (maven test) where their class path is:
src/test/java/uk/co/automatictester/jwebfwk/page/objects/MainPage.java
and package definition is:
package uk.co.automatictester.jwebfwk.page.objects;
public class MainPage extends ParentPage {
...
}
the preceding test/java
is not in the package name.
How is it done (in Eclipse)?
Solution
It depends on what you have set as your source directory, as an example get any folder in your directoy tree right click and put Build Path-> use as source folder
Answered By - jstuartmilne