ABC to Import a jar file in Netbeans 6.5

If you want to import a jar file in NetBeans, I guess I can help you out. Using the following procedure, you can import folders as well as other projects to the project you desire. I wanted to use the log4j for using logger in my application. So I had to import a jar file (log4j-1.2.15.jar) to the project. One of my friends helped me out, infact both of us just discovered how to import. Here we go…

I always feel that a picture can convey 1000 words, so the snaps. The following is what I did:

Right click on the project to which you which to import files. Note that the project need not be set as a Main project to import packages into it.

.Right Click on the Project Name !

Right Click on the Project Name !

In the window that opens, Choose Libraries in the left panel as shown below. On the right hand side of the window, I hope,  you can see an option called ‘Add JAR/Folder‘, click on that.

Select Libraries from the Left Panel !

Select Libraries from the Left Panel !

The new window that opens in familiar, I guess. Well, then Browse to the place where you have the jar file, select it and press ‘Open

Select the jar file you want to import

Select the jar file you want to import

As shown below, in a tab called ‘Compile‘, you can see the files that you have added (This is the default chosen tab, so after you have pressed ‘Open‘ in the previous step you will land here). Repeat the process if you want to add more files and then press ‘OK‘.

Click on Ok after you have imported

Click on Ok after you have imported

Another windows opens and you can see that the things you have added get saved (This is what the window shows :), it is just to see, nothing needs to be done).

The filed you have imported are saved

The filed you have imported are saved

As said earlier, the same procedure can be applied to add folders and other projects. If you had noticed, those where the other option in the image 2 shown above. Problems are Welcome  ! 😀


  1. 1
    310 Says:

    Java – Welcome

    For more information, […]…

  2. 2

    Hmm. Is it true? 🙂

  3. 4
    debayandas Says:

    THANKS alot for the help. And thanks for putting link to this page in the java forum.

  4. 5
    sligh Says:

    this helped me a lot.. thank you for posting this

  5. 7
    Richard Chen Says:

    Yes, thank you very much. It all looks simple now – I should have recorded all the other places in netbeans where I tried to add the .jar. Thanks again.

  6. 8
    Eng:M.TAHA Says:

    Hi,, i’m trying to add look and feel jar file and i do the steps and every thing is OK ,, but when I build the project the jar file that resulted doesn’t work with out the lib folder
    how can i make the jar file run and include the theme jar file ?

  7. 10
    Eng:M.TAHA Says:

    The problem solved but without netbeans thanks alot

  8. 12
    Sandro Says:

    Hi! Situation: a I have a my library (myLib) that use 3rd part libraries. I want use myLib in other project (bigPrj). Problem: on bigPrj, NetBeans does not copy the 3rd part libraries. Is there an automatic way for resolve the problem?

  9. 13
    Gopa kumar M.G. Says:

    Great work dear friend…!!! Thankx…!!

  10. 14
    Lucky Says:

    I could n’t get the output.
    I got an error that says class not found.That class is included in the jar file i added..
    Plz help me…

  11. 15
    midex Says:

    Thank you! Thank you!! Thank you!!!

  12. 16
    Abdullah Says:

    hi there,
    i added a jar file, but when i try to import any of its classes it gives error.
    like for example, when i:

    import net.sf.gsaapi.GSAClient;

    it gives error: “package net.sf.gsaap doesnt exist”

    im using Netbeans.

    • 17
      amal Says:

      same here,
      i imported the jena library, the same way as in this tutorial
      import com.hp.hpl.jena.rdf.model.*;
      it tells me that path doesn’t exist

  13. 18
    dinesh Says:

    Thanks very much dude….

  14. 19
    Inov Says:

    Thank you! After following the instructions detailed here, I was able to compile the program I’m having problems with.

    I initially tried to add the JAR file by clicking TOOLS, then selecting libraries. When I compile, it still cannot find the package which is in the JAR file I added.

    Thanks again I was able to find your post about this in one of the forums.

  15. 20
    nick Says:

    How to add jar file using java file coding?

  16. 21
    unicorn Says:

    best site ever !!!
    thank u so much
    u my have saved my life

  17. 22
    Milton Says:

    Muchas gracias andaba con un error y esto me recordo que faltaba agregar la libreria del conector, hasta pronto!!!

  18. 23
    Nani Says:

    hi ..i tried the procedure above to use a java3D class( it was very helpful) and add it to the library of the project i wanted to use on. It did remove all the compilation errors, but when i try to run the project, i get another exception like this..
    Jun 11, 2010 8:22:13 AM getSupportedOglVendor
    SEVERE: java.lang.UnsatisfiedLinkError: no j3dcore-ogl-chk in java.library.path
    Exception in thread “main” java.lang.UnsatisfiedLinkError: no j3dcore-d3d in java.library.path
    at java.lang.ClassLoader.loadLibrary(
    at java.lang.Runtime.loadLibrary0(
    at java.lang.System.loadLibrary(
    at Method)
    at d.HelloJava3Da.(
    at d.HelloJava3Da.main(

    what have i done wrong? please help

    • 24
      Camilo Says:

      Hey mate, i’ve got the same problem…

      The project does compile, but crashes when starting, showing the same messages you’ve posted.

      Information about how to properly configure Java3D libraries is quite welcome!!

  19. 25

    Thank you. Nice tip, this is not an intuitive process for newbies..


  20. 26
    Fiona Says:

    FINALLY!!! Your article opens my mind. Finally I can add JAR file into my NetBeans project. Thanks a lot 😀 *I’ve been searching the whole web for 2 hours before*

  21. 27

    […] UDDI access These links should help you: ABC to Import a jar file in Netbeans 6.5 G Praveen Kumar Creating, Importing, and Configuring Java Projects – NetBeans IDE Tutorial Please use […]

  22. 28
    Aviral Says:


    i followed all your steps, i am able to include the jar files, but when i use it in the code, it says package not found.

    Any help would be appreciated.


  23. 29
    siya Says:

    gud job..n thanks buddy

  24. 30
    Claudio Rauso Says:

    Thank you!

  25. 31
    ami Says:

    thank you so much for this!! helped me out a lot

  26. 32
    Lê Xuân Nguyên Says:

    I can’t

  27. 33
    Foxy Says:

    Yeah Dude!
    It cleaned all my doom on .jar files in the project =)
    Thx a lot!!!

  28. 34
    arifkhumaidi Says:

    Reblogged this on umek chatter b201crew and commented:
    weka for NETBEANS

  29. 35
    B Says:

    It helps me a lot thanks

  30. 36
    Gunda Says:

    Praveen Kumar…you are great!

  31. 37
    XXX Says:

    Awesome Praveen!! Its your love!!!!! I love you!!!!

  32. 38
    Ranjith Says:

    How to include the jar file’s into netbeans Mr.Praveen.. want to Add HDF Library fiiles in it…can u please suggestt an idea…

  33. 39
    sonu Says:

    now i have a problem….
    when u “clean and build” we get the jar file .
    and i converted it to exe .
    now the problem comes .it cannot find the external jar file which i have imported.
    please help me out…
    how to do…..

  34. 40
    Poophead Says:

    thanx praveen

  35. 41
    Harish Vembu Says:

    Hello Praveen,

    This is a kind of old Post. But I have a specific problem with my NetBeans.

    I am using
    Product Version: NetBeans IDE 7.3 (Build 201306052037)
    Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01

    I don’t see Libraries when I right click on the project and Properties. What do I do??

    This feature might not be there in newer versions of Netbeans.

    Could you please help me in providing a solution or workaround??

    Thanks in Advance.

    Best Regards


  36. […] ABC to Import a jar file in Netbeans 6.5 | G Praveen Kumar – Jun 17, 2009 · If you want to import a jar file in NetBeans, I guess I can help you out. Using the following procedure, you can import folders as well as other projects …… […]

  37. 43
    Aris Says:

    HELP! 🙂
    Hi and thanks for this post!I’ve done this exact same process to add the jsfml for graphics and stuff!I imported the jar file and I had absolutely no errors at compile time when I used for example package…BUT when I run the programme I get this error :
    Caused by: java.lang.ClassNotFoundException:……
    I even created a new library and put it in and again it compiled but didn’t run(Although I noticed that for some reason it did not have any classpath like the other libraries)
    It may be really simple but I’ve spent many hours and I just can’t figure this out…I’d really appreciate any help!
    Thank you in advance :)!!

RSS Feed for this entry

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: