Bug 250103 - Support bundled JRE with Mac OS X
Support bundled JRE with Mac OS X
Status: REOPENED
Product: installer
Classification: Unclassified
Component: NBI
8.0.2
PC Mac OS X
: P3 with 1 vote (vote)
: TBD
Assigned To: emi
issues@installer
82patch-candidate
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-01-29 22:04 UTC by phansson
Modified: 2017-05-02 01:54 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Proposed patch (1.28 KB, patch)
2015-01-29 22:15 UTC, phansson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description phansson 2015-01-29 22:04:57 UTC
NBI currently doesn't support a bundled JRE with Mac OS X. This is very easy to fix. (I'll get to that)

Why this is so, I don't know, but I'm assuming the reason is that at the time NBI was created the concept of a bundled JRE on Mac OS X was somewhat alien. At that time Mac OS X *always* came with a pre-installe JRE. Today Mac OS X comes without a JRE pre-installed and Apple actively encourages developers to bundle a private JRE with the application. In fact if you want your application in the Mac App Store then you MUST bundle a private JRE with your application.

Here's how to fix it:

In the NBI Engine project locate file org/netbeans/installer/wizard/components/actions/CreateMacOSAppLauncherAction.java.

To this file you simply have to add the same code as exist in the equivalent CreateNativeLauncherAction.java file in same directory.

So, in CreateMacOSAppLauncherAction.java just before

File file = SystemUtils.createLauncher(properties, platform, progress).
                    getOutputFile();

you must add:

  if (System.getProperty(BUNDLED_JVM_FILE_PROPERTY) != null) {
      final LauncherResource jvm = new LauncherResource(
           new File(System.getProperty(BUNDLED_JVM_FILE_PROPERTY)));
              properties.addJVM(jvm);
              properties.getJvmArguments().add(
                   "-D" + BUNDLED_JVM_FILE_PROPERTY + "="
                    + jvm.getAbsolutePath());
  }


I've done this patch successfully and I'm now able to bundle a private JRE with the NB Installer on Mac OS X.
Comment 1 phansson 2015-01-29 22:15:50 UTC
Created attachment 151735 [details]
Proposed patch

Patch file attached
Comment 2 cosette 2015-04-22 11:27:39 UTC
Hi,

How can we get NBI Engine project to modify "CreateMacOSAppLauncherAction.java"??
I have /netbeans-8.0/harness/modules/ext/nbi-engine.jar, and it contains "CreateMacOSAppLauncherAction.class", and I have "/netbeans-8.0/harness/nbi/stub/ext/engine/src/org/mycompany/installer/wizard/components/actions" package but it does not contain "CreateMacOSAppLauncherAction.java"

Thanks!
Comment 3 phansson 2015-04-25 12:27:56 UTC
@cosette

The recipe/workaroubd above assumes that you know how to check out and build a core NB project, in this case "NBI Engine" project. This is not the place for such explanation. It is quite well documented on netbeans.org. 

I would say, however, that doing so is not for the faint of heart. Hence it is better if NB team could fix this rather than each of us having to do the fix on our own.
Comment 4 _ wadechandler 2016-01-15 03:43:59 UTC
I think supporting embedded JRE across all platforms is a necessity as a RCP. That should have always been a goal of the JDK as well. I believe the rise of apps has shown us that. We now have app stores on all the major desktops too. Your normal user does not want to configure an application just so it starts. They also do not care if there is some system component they have to install, and if they do then it is really just a pain and not a feature.
Comment 5 emi 2017-04-21 17:02:05 UTC
Any particular reason this patch is not being applied?

It seems self-contained and there's no obvious way it could break any of the existing uses.

Unless vetoed, I will assume silent consent and apply this patch in 10 days.
Comment 6 emi 2017-05-01 05:08:37 UTC
Patch applied: https://hg.netbeans.org/jet-main/rev/e01ab434ec62

Many thanks to Peter Hansson.
Comment 7 emi 2017-05-01 05:15:49 UTC
This also seems a good patch candidate.
Comment 8 Quality Engineering 2017-05-02 01:54:10 UTC
Integrated into 'main-silver', will be available in build *201705020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e01ab434ec62
User: Emilian Bold <emi@netbeans.org>
Log: #250103: Support bundled JRE with macOS (thanks to Peter Hansson)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo