Using Java's default package in Eclipse
eclipse, java, package
Solution
Eclipse, and most other IDEs, are geared towards large projects. Hobbyist programming and small-scale assignments can get by in IDEs often, but be aware that the general assumption would be for larger projects - anything between 10 and 5,000+ classes.
There is also a chance that you create a class which has a similar name to something in the Java API - for example:
- `java.rmi.MarshalException` and
- `javax.xml.bind.MarshalException`
Ambiguity in instantiating the class (`throw new MarshalException();`) if both classes exist on the same classpath is a compilation error.
Problem
In Eclipse, when I start a new Project, I go through the wizard, and when I get to writing my first class for that project I am asked to select a package. Sometimes out of laziness I just choose the default package. The wizard warns me this is discouraged. Even if I ignore the warnings I never have any problems with the application due to this. Or at least, so far I have never had any problem. So why does Eclipse want me to create a new package?