Matrix Zion
Matrix Zion

Reputation: 1

About java default package(using Eclipse)

Now, I'm using some methods by using a jar. But these classes I use have no package names.

I can use reflection to solve the problem of using these methods.But now I want to override some of the interface and classes.

However,others can extends these classes directly without any compilation error on their computers using Elcipse, while I extends directly, I have this compilation error:

(classname) cannot be resolved to a type.

Is there any chance configuration on my Elcipse is different from others?

I'm so confused now...

Upvotes: 0

Views: 3160

Answers (1)

GhostCat
GhostCat

Reputation: 140613

Just don't do that.

Using the default empty package has no place in "real world" code bases.

Instead of wasting your time on working around those default package classes you refactor them, by putting them into real packages; making good use of those access controlling keywords public/private/...

Reflection for example should only be used in very special situations. For sure not to fix missing package names.

Upvotes: 3

Related Questions