Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Default Package's Classes in NetBeans

I have a jar file named "stdlib.jar". This has many classes in its "Default Package". I have added this stdlib.jar to my NetBeans Libraries. and Also "Build"-ed it without using anything from stdlib.jar . So that stdlib.jar can be added to my "./dist/lib" folder. But still I can't use any classes within stdlib.jar What should I do to reuse any classes within stdlib.jar?

like image 669
soham Avatar asked Aug 22 '12 05:08

soham


1 Answers

Using "Default Package" package for libraries or even for a project is highly discouraged. If you use default package then the classes name should be unique or else they will override all the java.lang classes.

Now coming to your situation. To use your stdlib.jar if you've added it in your library then you should be able to use it. You can use your stdlib.jar from your default package of the project in which you are using it. Other than default package you cannot use it as it will search your stdlib.jar class in that package.

Hope this makes you clear. Thanks.

like image 91
pratikabu Avatar answered Sep 21 '22 01:09

pratikabu