|
|
|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

05-27-2008, 11:45 PM
|
|
Member
|
|
Join Date: May 2008
Posts: 6
|
|
|
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!
|
|

05-28-2008, 06:06 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
|
|
|
I'm not clear what you are looking for. Adding a third party jar file to your project? What you mean third part?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Someone helped you? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post. Help: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Resources: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Web: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Tips: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

05-28-2008, 04:13 PM
|
|
Member
|
|
Join Date: May 2008
Posts: 6
|
|
|
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
|
|

05-29-2008, 08:27 PM
|
|
Member
|
|
Join Date: May 2008
Posts: 6
|
|
|
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).
|
|

05-29-2008, 08:41 PM
|
 |
Member
|
|
Join Date: Apr 2007
Location: Midwest
Posts: 60
|
|
|
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.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

05-30-2008, 06:02 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
|
|
Originally Posted by jodyflorian
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.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Someone helped you? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post. Help: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Resources: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Web: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Tips: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
All times are GMT +3. The time now is 01:44 PM.
|
|
VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org