I'm having problems importing a class that doesn't belong to any package. My professor mentioned there is such a thing as the "blank" package, and that this class belongs to that package. How do I import it then?
In my imports I have:
and in my terminal (Windows) I type this: javac -classpath .\sinf1160.jar;.\BarCode.class;.\Registre.class <filename>
Yes sorry, I think when I said the "blank" package I meant to say the "default" package. However if it can't be imported then I've got quite a big problem at hands because my professor just gave us the .class file so I can't put it in any other package if I wanted to... I guess I'll just ask him for help directly. Thanks for your help anyway guys
Joined: Oct 13, 2005
If you have a .class file you should be able to use it without requiring an import. Or you could search for decompilers . . .
Originally posted by Campbell Ritchie: As far as I remember, it is not possible to import from the "default" package.
This used to be possible in older versions of Java, but it is not possible anymore since (I think) Java 5.
The only way to use classes in the "default" package is to put your own class in the "default" package (i.e., don't put a package statement in your code). But it's really not recommended to put classes in the "default" package. Your professor should really change his code and put his class Registre in a package.