Results 1 to 17 of 17
  1. #1
    ehsen is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default Netbeans not recognizing library

    I added Jidesoft swing library in my project but when I use the import statement " import com.jidesoft.popup" netbeans gives the error "package com.jidesoft" doesn't exist. please tell me how i fix this thing.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by ehsen View Post
    I added Jidesoft swing library in my project but when I use the import statement " import com.jidesoft.popup" netbeans gives the error "package com.jidesoft" doesn't exist. please tell me how i fix this thing.
    How did you add the package to your project?

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Yes better to give more details, because this can be done in several ways, with or without using the NetBeans.

  4. #4
    ehsen is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default

    Here is what I did...

    Right Click on Libraries in Project window > ADD Jar/Folder > Select the jidesoft jar file.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Is that JAR file added into that Libraries folder correctly? And also can you tell me what's the JAR file name is?

  6. #6
    ehsen is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default

    yup I can see the jar file in my libraries folder (in project window). jar file name is " jide-os-2.7.1"

  7. #7
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    try to save the jar / lib (for the Library) on your hard disk and the static path (it means if you put your .jar library to F:/Java/Projects/lib -> then stay in there, don't move it)

    hope it works

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by sysout View Post
    try to save the jar / lib (for the Library) on your hard disk and the static path (it means if you put your .jar library to F:/Java/Projects/lib -> then stay in there, don't move it)

    hope it works
    That doesn't make much sense.
    Basically they need to have the relevant packages on the classpath before they can use them. Either they haven't added the jars to the correct project's classpath or the jars they have added do not have the packages they are trying to use.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by ehsen View Post
    yup I can see the jar file in my libraries folder (in project window). jar file name is " jide-os-2.7.1"
    Your jar file name is jide-os-2.7.1, and you import it as com.... something. It cannot happen, in import have to use the same file name.

  10. #10
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by Eranga View Post
    Your jar file name is jide-os-2.7.1, and you import it as com.... something. It cannot happen, in import have to use the same file name.
    Not it does not have to. You can have a jar file called fronobolaux that contains a package called r035198x.defenestrated with a class called Wibble.
    To use the Wibble class you make the fronobolaux be available on the class path and do
    import r035198x.defenestrated.Wibble;

    The jar file name has nothing to do with the imports.

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I'm not clear what you are talking about. Just add a jar file in the NetBeans and if you can call it with a different name. You cannot do that.

  12. #12
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by Eranga View Post
    I'm not clear what you are talking about. ...
    Then read my post above again.
    Quote Originally Posted by Eranga View Post

    Just add a jar file in the NetBeans and if you can call it with a different name. You cannot do that.
    It has nothing to do with Netbeans. A jar file's name has nothing to do with the imports that should be done to import its classes. What matters is the names of the packages that are inside the jar not the name of the jar file itself.

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Ya, I know that jar has nothing to do with NetBeans, it's all related with the classpath.

    Quote Originally Posted by r035198x View Post
    What matters is the names of the packages that are inside the jar not the name of the jar file itself.
    Okay, say I added a jar file into the classpath, and assume that the name is demo.jar. You say that I can import the package as something,

    import myjar.*;

    is it?

  14. #14
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Yes. If the jar file demo.jar contains the package "myjar" the the import will work as well.
    It's not jar files which are imported. It's classes and packages inside jar files.

  15. #15
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by r035198x View Post
    Yes. If the jar file demo.jar contains the package "myjar" the the import will work as well.
    It's not jar files which are imported. It's classes and packages inside jar files.
    Oh seems we are talking about completely two things here. I'm talking about just a jar file with only class files, not with jar file embedded.

    And also seems to me you've never try it in NetBeans. In NetBeans you cannot see that a jar file, which is included inside another package. You have to use the complete path.

  16. #16
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by Eranga View Post
    ...
    And also seems to me you've never try it in NetBeans. In NetBeans you cannot see that a jar file, which is included inside another package. You have to use the complete path.
    Oh believe me I have used Netbeans a lot.
    Jar files are not included inside packages. It's packages that are bundled as a jar file.

  17. #17
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by r035198x View Post
    Oh believe me I have used Netbeans a lot.
    Jar files are not included inside packages. It's packages that are bundled as a jar file.
    I'll give a try this and see.

Similar Threads

  1. HTTPServlet library
    By Robert_85 in forum Advanced Java
    Replies: 1
    Last Post: 04-10-2009, 08:28 PM
  2. Tell me jar file for library library org.bouncycastle.cms
    By 82rathi.angara in forum New To Java
    Replies: 10
    Last Post: 09-09-2008, 05:11 AM
  3. add previous jar library to new one
    By Farzaneh in forum Eclipse
    Replies: 1
    Last Post: 08-23-2008, 02:31 PM
  4. use a .dll library
    By Ed in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2007, 03:07 PM
  5. JPedal PDF library 3.21
    By levent in forum Java Software
    Replies: 0
    Last Post: 06-20-2007, 07:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •