ritratt
ritratt

Reputation: 1858

How do I use API's in Netbeans for JAVA?

Ok so there are tonnes of API's out there. I need to use some of them like JIntellitype, iText, docx4j etc. But the problem is I do not know how to go about it in Netbeans.

I tried following the instructions in readme for all these API's but it does not work since there is something I am doing wrong. I am a newbie at JAVA and Netbeans.

Thanks!

[Update]
This is what I tried to do.

  1. I downloaded the JIntellitype API. It contains lots of files including JAR,DLL,CPP etc. When viewed through File->Open Project from Netbeans this folder is displayed as a project.
  2. I created a new JAVA Application project from Netbeans.
  3. I right clicked the Project->Properties->Library and added the API folder there.
  4. Then I tried importing one of the classes from the API called HotkeyListener as follows:

    import jintellitype.HotkeyListener;

I received an error saying package does not exist.

Upvotes: 1

Views: 14091

Answers (2)

stbas
stbas

Reputation: 61

like AlexR said, you should add the jar file with the jintellitype.HotkeyListener in it, not just the directory. You can open jar files with winrar, winzip, 7zip etc... Regards

Upvotes: 2

AlexR
AlexR

Reputation: 115418

Generally you have to add your API jar to your project. Open project properties, find where external libraries are added and add them. Once you are done you can import library classes and use them.

Upvotes: 4

Related Questions