Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Java and Jar files

Posted on 2004-08-27
5
Medium Priority
?
178 Views
Last Modified: 2010-03-31
Hi,
   I've written a small app that uses data stored in  important.jar

   This is in my classpath so everything works nicely. Now I want to package up my app into  mywork.jar - but of course when I run it, it complains about not being able to find the files from important.jar

   Is there an easy way to put them all in the same jar file?  I really only want to give users a single file to work with instead of a small collection :)


thanks in advance!
0
Comment
Question by:petepalmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 11918782
Assuming you want to create an executable jar, then add a Class-Path attribute to your jars manifest to specify the (relative) location of the other required jar

eg. if important.jar is in same directory then add:

Class-Path: important.jar
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 11920369
Why not bundle everything together in ONE jar?
;JOOP!
0
 
LVL 1

Author Comment

by:petepalmer
ID: 11920416
I was hoping there was a way to do it with just one jar as opposed to two. The reason I don't want to take the files out of important.jar is that it's maintained by a friend of mine so I want it to be easy to update. Granted if I use classpath upgrading is simplicity itself - you just copy over the new jar file... but is there no other way? :)


0
 
LVL 92

Expert Comment

by:objects
ID: 11920618
how can you do it with one jar, but without taking the files out of important.jar :)
If you use the appraoch I suggested above then there is no change required to the classpath.
0
 
LVL 1

Author Comment

by:petepalmer
ID: 11920689
I couldn't think of another way either.... couldn't find anything in the docs... but just hoped I was being thick :)

Ah well, two jar files it is then! :)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question