Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 224732 - [jar exporter] Provide more functionality with JarExporting
Summary: [jar exporter] Provide more functionality with JarExporting
Status: RESOLVED DUPLICATE of bug 219530
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-28 17:00 EDT by Rolf CLA
Modified: 2008-09-04 06:18 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf CLA 2008-03-28 17:00:17 EDT
Build ID: Eclipse M5

Steps To Reproduce:
I have noticed a new export option in 3.4, bugzilla #83528 "Fat Jar exporting".  Basically all of the jars in the class path go to one jar.  This approach, while useful has a number of potential draw backs:
-Servicing becomes problematic (especially for external jars)
-We may not have the rights to rejar external jars as part of our project
-property files/resources can mix-match

I propose a system similar to fat jar exporting except a destination directory is specified and all of the projects go to individual respective jars + all of the external jars are copied intact to the external directory.


More information:
I may be able to contribute this code.
Comment 1 Martin Aeschlimann CLA 2008-03-31 04:50:36 EDT
see bug 219530: add Jar-in-Jar ClassLoader option
	
I'm adding Ferenc, who contributed the Runnable JAR wizard. Ferenc, can you comment?
Comment 2 Ferenc Hechler CLA 2008-03-31 16:21:05 EDT
I like the idea.
An option could be added to the Runnable JAR File Export Wizard whether referenced JARs should be packaged into the JAR or copied next to the executable JAR.

In the latter case, all referenced JARs ("ref1.jar", "ref2.jar", ...) could be put into a subdir "lib/" and added to the Manifest Class-Path of the executable JAR ("lib/ref1.jar lib/ref2.jar ...").
The executable JAR can then be started using the -jar option.

Most of the drawbacks mentioned by Rolf might be solved using the JAR in JAR Classloader, but there are other reason, why this solution might be usefull. E.g. when resources have to be accessed as files and not as streams.

feri
Comment 3 Ferenc Hechler CLA 2008-04-01 13:00:57 EDT
We could separate class files from resource files. Classfiles will be packaged into the executable JAR and resource files (like *.properties, configs, ...) will be stored in a resources/ subfolder (parallel to the lib/ folder).
Comment 4 Ferenc Hechler CLA 2008-04-21 04:53:22 EDT
Hello Rolf,

> I may be able to contribute this code.

if you have any questions about how to integrate just ask me (ferenc.hechler@web.de).

Best regards,

   feri
Comment 5 Benno Baumgartner CLA 2008-07-23 03:27:01 EDT
Rolf? Do you still need this functionality even if we provide the Jar in Jar classloader? (bug 219530)

The idea of the runnable jar wizard is that we generate a jar which can be executed by double-clicking it. If we store the required libraries outside the jar then this won't work anymore.
Comment 6 Rolf CLA 2008-07-23 20:24:04 EDT
Unfortunately, I won't be able to contribute this code

If it's added as part of the manifest class path, then won't the user still be able to double click on it?

I still think there is some value in this approach over Jar in Jar i.e.:
-easier servicing
-as Fernec mentioned accessing resources
-It seems "simpler" to me. 

But the Jar in Jar meets my needs (and I expect most users...)  So I can resolve as WORKSFORME if you guys don't see a need for this....

Thanks,
-Rolf
Comment 7 Ferenc Hechler CLA 2008-07-24 03:52:46 EDT
Hello Rolf,

> If it's added as part of the manifest class path, 
> then won't the user still be able to double click on it?
Yes, the jar file will be executable, because the Main-Class is defined in the manifest. Also all external libs have to be set in the Class-Path of the manifest.

I think this feature is useful. All the single staps can be done with the normal JAR exporter and manually copying the libs, but to have a wizard to create a distribution with one click looks much better.

The user can decide whether he wants an All-in-one-File (Fat-Jar) distribution or a ZIP-File which can be unzipped to be runnable.

> So I can resolve as WORKSFORME if you guys don't see a need for this....
I would like to integrate this feature.
Because of the dependancy to bug 219530 I would like to do both in one patch.

Best regards,

    feri


 

Comment 8 Dani Megert CLA 2008-07-31 04:01:23 EDT
Will be implemented as part of bug 219530.

*** This bug has been marked as a duplicate of bug 219530 ***