Results 1 to 6 of 6
  1. #1
    jodyflorian is offline Member
    Join Date
    May 2008
    Posts
    6
    Rep Power
    0

    Default Simple newbie problem: import 3rd party jar

    Hi,

    I'm new to Java (2nd year Java student) and am like a headless chicken trying to use a third party jar file in my project.

    I've tried googling for help but am clearly missing something - I would post what I've tried, but it would be pointless since I haven't really got anywhere! I would have thought this should be as easy as pie given Java's qualities but it would seem Java and stupidity are incompatible!!

    Any help would be hugely appreciated!

  2. #2
    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 looking for. Adding a third party jar file to your project? What you mean third part?

  3. #3
    jodyflorian is offline Member
    Join Date
    May 2008
    Posts
    6
    Rep Power
    0

    Default Thanks

    Hi Eranga,

    Thanks for your reply.

    I have a JAR file that someone has written as a wrapper for a DLL. I would like to use the wrapper (4 or so methods) in my application.

    The problem is, when I try to include the JAR using a java import statement in my code it can't locate the library.

    Thanks again

    Jody

  4. #4
    jodyflorian is offline Member
    Join Date
    May 2008
    Posts
    6
    Rep Power
    0

    Default

    Ok I think I've bumped into how to do it:

    1) Create new project
    2) Right-click project -> "import"
    3) General -> File system
    4) Open directory containing JAR file
    5) Click the checkbox next to the JAR file, click OK
    6) Right click on the JAR file ->
    7) Build Path -> Add to build path
    8) Then in the source, import the package name as listed under the JAR tree.

    The build path was what I missed! (And I wasn't sure if I had to import the jar file, or if I had to add it to the project some other way).

  5. #5
    orchid's Avatar
    orchid is offline Member
    Join Date
    Apr 2007
    Location
    Midwest
    Posts
    60
    Rep Power
    0

    Default

    1.Put the jar in your project in a folder called lib (make it if it does not exist.
    2. right click on project >>Properties>>Java Build Path
    3. Click on the Libraries tab
    4. Add Jars, find the jar you just copied and click ok, then ok and the workspace should rebuild.

  6. #6
    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 jodyflorian View Post
    Hi Eranga,

    Thanks for your reply.

    I have a JAR file that someone has written as a wrapper for a DLL. I would like to use the wrapper (4 or so methods) in my application.

    The problem is, when I try to include the JAR using a java import statement in my code it can't locate the library.

    Thanks again

    Jody

    Yes, you can't add them directly as Java libraries do. You have to do few changes. All about that you get two replays. Read them and try.

Similar Threads

  1. Replies: 2
    Last Post: 05-04-2008, 05:27 PM
  2. My Simple Refresh Problem
    By pmcastillo in forum New To Java
    Replies: 0
    Last Post: 03-26-2008, 07:59 AM
  3. New to JSF, simple problem with Eclispe and Tomcat
    By nibeck in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-16-2007, 05:53 PM
  4. simple problem - code wont compile
    By dirtycash in forum New To Java
    Replies: 1
    Last Post: 11-20-2007, 05:49 PM
  5. problem with a simple java code
    By boy22 in forum New To Java
    Replies: 2
    Last Post: 08-03-2007, 02:46 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
  •