This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 239238 - Support JVM bundling with other than Info-Zip
Summary: Support JVM bundling with other than Info-Zip
Status: NEW
Alias: None
Product: apisupport
Classification: Unclassified
Component: NBI (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-08 13:11 UTC by phansson
Modified: 2016-10-30 02:46 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
JRE bundle size test (320.34 KB, application/force-download)
2013-12-11 22:03 UTC, phansson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description phansson 2013-12-08 13:11:45 UTC
The NBI has a feature whereby a JRE can be bundled as a self-executable compressed archive.

In order to execute the archive NBI will add a '-d' option to the command line. Unfortunately this option is very specific to Info-ZIP's version of self-executables. This excludes use of other archive methods, for example 7Zip. 

For one reason or another 7Zip compresses a JRE far better than Info-ZIP. It is also better documented. In contrast the Info-ZIP project seems rather abandoned and it is not trivial to get hold of the 'unzipsfx' stub needed to create the self-executable.

What to do about it:  The '-d' option to Info-Zip's unzipsfx specifies a target directory to unzip into. Instead of using this option the same effect can be achieved by first changing the working directory into the target directory (creating it if it doesn't exist) and then executing the self-executable archive which will then uncompress into the current directory. Hence the suggestion is to avoid any command line arguments on the self-executable archive.

This way the user of the NetBeans Platform is free to use his/her own choice of archiving mechanism as long the archiving mechanism can produce a self-executable archive.
Comment 1 phansson 2013-12-11 22:03:16 UTC
Created attachment 143081 [details]
JRE bundle size test

Results of test: Info-ZIP will create an archive of approx 38 MBytes while 7Zip can do the same archive in approx 24 MBytes. This is a very significant difference !
Comment 2 phansson 2013-12-11 22:06:20 UTC
JRE bundle size test:

Info-ZIP :  38 MBytes
7Zip :      24 MBytes

See attachment for further details.  

This explains why this RFE will bring a *significant* benefit.
Comment 3 phansson 2015-01-29 22:35:28 UTC
Here's how to fix. You only need to REMOVE code.

In the "NBI Native Launcher : Windows" project locate source file JavaUtils.c.

Locate function installJVM() within that file.

Locate the two lines:
  appendCommandLineArgument(&command, L"-d");
  appendCommandLineArgument(&command, jvmDir);

and replace instead with:

 // Adding "-d" to command line on self-extracting archive is not a very
 // good idea because it means NBI will only work with self-extracting archives
 // binaries that actually understands this option (for example Info-ZIP will understand it,
 // 7Zip will not). The argument means "extract to this directory", but that
 // is unnecessary as the executeCommand() below will already have a 'working directory'
 // argument attached to it ... so even without the -d option we still get our
 // archive extracted into the right location. For this reason the following two
 // lines have been removed.
 //appendCommandLineArgument(&command, L"-d");
 //appendCommandLineArgument(&command, jvmDir);

The comments I've added above hopefully explains why the change is solely a benefit and has no adverse effects.

I've used the change successfully in my own projects. (where I package with 7Zip, not Info-Zip, in order to save the extra 40-50% on package size).
Comment 4 phansson 2015-06-22 23:30:59 UTC
Just for the record: 

The equivalent change is *not* required in launcher.sh (for Unix/linux/MacOSX) since the launcher.sh is not trying to add "-d" option to the command.
Comment 5 konsolebox 2016-10-30 02:46:22 UTC
Any updates on this?