0


I imported a jar file into Eclipse.

So, in Eclipse by right-clicking on the Project → Build Path → Configure Build Path. Under Libraries tab, clicking Add External JARs and giving the Jar file.

Now I can see it in "Referenced Libraries" in "Package Explorer".
In .jar files like "common-math.jar", there are many packages like "org.apache.commons-math" and etc. that we can import these packages in our codes for using them.
But in the .jar file that I have added it, there is just one package that its package name is (default package). How can I import it into my codes?
This code has an error:

import (default package).xxxxxxxx;
Syntax error on tokens, Name expected instead

My Jar file
I see also how to determine package name of a class in a jar file Ask Question

user7194905
  • 217
  • 2
  • 9

1 Answers1

0

(default package) means that the classes in the jar do not have any package. To import class SomeClass from the jar you just need

import SomeClass;

without qualifying it with a package name.

StephaneM
  • 4,779
  • 1
  • 16
  • 33
  • The hierarchy is: Referenced Libraries -> armstrong.jar -> (default package) -> Armstrong.class. The** import Armstrong;** cannot be resolved. – user7194905 Mar 08 '18 at 10:25