I have classes in an Entities package, but I still want to run import stuff that is in the default package... how do I do that?
Asked
Active
Viewed 3,135 times
1
-
1possible duplicate of [How to access java-classes in the default-package?](http://stackoverflow.com/questions/283816/how-to-access-java-classes-in-the-default-package) – tangens Sep 30 '10 at 22:33
-
possible duplicate of [What's the syntax to import a class in a default package in Java?](http://stackoverflow.com/questions/2030148/whats-the-syntax-to-import-a-class-in-a-default-package-in-java) – Pops Nov 22 '11 at 19:50
1 Answers
1
You don't.
Sorry.
Though I'm quoting the other answer, you can check out the ORACLE reference that says that that is intended behaviour.
I recommend moving your stuff to a named package.
If you absolutely cannot re-factor, you can try using reflection to access it. Again, check the answer linked above.
-
http://en.wikipedia.org/wiki/Reflection_(computer_science) - Basically, it is Java's way of creating instances of classes and calling methods without importing the class. It is a huge pain, and I don't recommend it. – Andres Oct 01 '10 at 00:57