简体   繁体   中英

How to use classes from the .jar lib added to netbeans project?

Can anybody help me out in this? what I have is a abc.jar file with me. It contains ABC.class file inside it. I added the jar file to netbeans project Libraries. But I am getting an error when I write ABC a=new ABC();

Error : "can not find symbol class ABC"

any help?

Edited : also I am able to see the structure of ABC class when I click on the ABC.class file inside the library.

Remember to import it with an import statement. You should probably read the documentation that follows the jar file. Hopefully there's an example of usage - mostly there is.

The answer : I found out that if the jar has only default package you won't be able to import classes inside it. You need to have packages other than default inside the jar to import it. You can only import non default packages. the thing with default packages works fins in eclipse, but not in netbeans.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM