Export Jar file does not show included jar files [message #14469] |
Mon, 05 May 2003 18:24  |
Eclipse User |
|
|
|
Originally posted by: stevenw.us.ibm.com
Running eclipse 2.1. I have a Java project and have added several jar
files in the Java Build path and checked them for export. When I export
a jar file for the project the jar files in the build path are not shown
for selection. I have also imported the jar files into the project
itself, but it still does not show the jar files. This senerio worked
under eclipse 2.0. Is there something I need to do or missing? Is this a
known problem?
regards, steve
|
|
|
|
|
|
|
Re: Export Jar file does not show included jar files [message #35612 is a reply to message #28200] |
Thu, 22 May 2003 14:41   |
Eclipse User |
|
|
|
Originally posted by: chris.junctionbox.com
Hi Daniel,
Sorry, but I'm still confused, and I've spent another hour trying to
resolve this. Could you outline
step by step what I have to do from the start right
through to export? Suppose I have a jar file my.jar which is in a
directory outside of my project.
Thanks,
Chris.
Daniel Megert wrote:
> Chris Aves wrote:
> >Hi Daniel, I am trying to do this too, but I'm new to Eclipse.
> >
> >Could you be more specific on how to do this? If in the properties of my
> >project I add an external
> >JAR, it gets added to the root of the project, and to the build path.
> >
> Sure that's the result of your action (adding it to the root ;-). You
> have to create a directory (e.g. lib) put the JAR into that directory
> and then put "lib/my.jar" to the Java build path.
> >Secondly the only way I can
> >get a JAR at the root of the project is by importing it as a file, in
> >which case it then gets its
> >containing directory in the root of the project.
> >
> Correct. You import the JAR as file. You will then see it e.g. as my.jar
> but you will not be able to drill into it since it is not on the Java
> build path.
> HTH
> Dani
|
|
|
|
|
My solution [message #38276 is a reply to message #36808] |
Sun, 25 May 2003 04:41   |
Eclipse User |
|
|
|
Originally posted by: chris.junctionbox.com
Further to what I wrote above, rather than write a specific class loader
for my application which
finds the .jar in question, I unjar'd the .jar into my project directory,
then jar'd up the application
myself.
It would be useful to be able to do this in Eclipse with the Import
function. You can import .jar
files by importing them as .zip's (which causes the jar contents to be
extracted and populated in
the project). But, currently, in Eclipse 2.1, importing only imports the
resources, i.e. gif's etc. and
not .class files.
Chris.
Daniel Megert wrote:
> Chris Aves wrote:
> >Hi Daniel,
> >
> >Sorry, but I'm still confused, and I've spent another hour trying to
> >resolve this. Could you outline
> >step by step what I have to do from the start right
> >through to export? Suppose I have a jar file my.jar which is in a
> >directory outside of my project.
> >
> 1. Open the properties of your Java project (it has to be a Java project)
> 2. Click on "Java Build Path"
> 3. Click on "Libraries" tab
> 4. Click "Add External JARs..."
> 5. Select your my.jar and click "OK"
> 6. Click "OK" on the properties page
> ==> The JAR is now on the build path
> 7. Select your Java project
> 8. Select "Import..." from the context menu
> 9. Select "File system" and click "Next >"
> 10. Click the upper "Browse..." button
> 11. Select the folder in which my.jar resides
> 12. Select my.jar on the right side
> 13. Ensure that "Create selected folders only" is checked
> 14. Click "Finish"
> ==> The JAR is now in your project (top-level)
> If you now export your project to a JAR you will be able to select the
> JAR. However, the use of this is quite limited because normal class
> loaders will not find classes in a JAR that resides in a JAR. I suggest
> to think about this again to be sure that this is really what you want.
> Dani
|
|
|
Re: My solution [message #39049 is a reply to message #38276] |
Mon, 26 May 2003 04:43  |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
Chris Aves wrote:
>Further to what I wrote above, rather than write a specific class loader
>for my application which
>finds the .jar in question, I unjar'd the .jar into my project directory,
>then jar'd up the application
>myself.
>
Why this? Why don't you simply put your code plus the JAR on to the Java
build path? If you need to distribute the code you should first JAR your
plain code and then use ZIP (i.e. File > Export > Zip File) to bundle
the existing JAR plus the JAR with your code. Putting two JARs into one
JAR is not a good idea because it lacks the hint that the archive needs
to be unpacked before running.
>It would be useful to be able to do this in Eclipse with the Import
>function. You can import .jar
>files by importing them as .zip's (which causes the jar contents to be
>extracted and populated in
>the project). But, currently, in Eclipse 2.1, importing only imports the
>resources, i.e. gif's etc. and
>not .class files.
>
Of course it does. The standard import has no knowledge of Java. If your
archive contains .class files and you select them for import then they
will be imported. Maybe they are hidden due to some filter or because
you are in the Package Explorer.
Dani
|
|
|
Powered by
FUDForum. Page generated in 0.34780 seconds