You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Zoran Sevarac <se...@gmail.com> on 2021/11/23 08:33:16 UTC

How to bundle JDK with NetBeans

Hi,

Is there any info about the best way to bundle OpenJDK with Netbeans
Platform Application?
I've tried setting on conf file
netbeans_jdkhome="zulu8.58.0.13-ca-jdk8.0.312-win_x64"

But when I run the app it keeps using the default jre (shown in About
dialog).
I've tried the absolute path with the same result.
Is it possible to specify which JRE NetBeans should use to run on?

Thanks
Zoran

-- 
Zoran Sevarac, PhD, Associate Professor
University of Belgrade, Faculty of Organisational Sciences, Department for
Software Engineering
Java Champion <https://community.oracle.com/community/java/java-champions>
| Oracle Groundbreaker Ambassador | Deep Netts <http://www.deepnetts.com>
Co-founder & CEO

Re: How to bundle JDK with NetBeans

Posted by Zoran Sevarac <se...@gmail.com>.
Thanks for the detailed article and for sharing your experience Lars.

Where would be the best place to create a page to put all stuff related to
installers and bundling JRE/JDK?

Cheers


On Tue, 23 Nov 2021, 18:09 Lars Bruun-Hansen, <lb...@gmail.com>
wrote:

> Hi Zoran
>
> It has indeed been possible for many years to bundle a JRE with a
> NetBeans Platform installer.
> It is documented here: https://dzone.com/articles/including-jre-in-nbi
>
> The advantage is that you can simply distribute a single file to your
> users which is an Installer executable (e.g. a .exe on Windows, a .sh
> on Linux, etc). Inside the executable there will be a bundled JRE
> which is silently unpacked and then used to launch the actual Java
> code which forms your Installer logic. The same JRE can then also be
> used for launching the application itself.
>
> There's an annoying "bug" which means that you MUST re-package your
> JRE bundle (say from Azul) using Info-ZIP and not some other archiving
> tool. [NETBEANS-6228].
>
> However: All of the above assume that you use NBI (NetBeans Installer)
> with all of its Ant magic, convoluted way of working and lack of
> documentation (IMO). It does work, though. But I can for sure applaud
> Neil's effort to take a different route. I've struggled a lot with NBI
> and - even if I was eventually successful - I'm not sure I can
> recommend the experience.  :-)
>
> /Lars
>
>
> On Tue, Nov 23, 2021 at 4:14 PM Neil C Smith <ne...@apache.org>
> wrote:
> >
> > On Tue, 23 Nov 2021 at 15:06, Zoran Sevarac <se...@gmail.com> wrote:
> > > Using jdkhome worked. Thanks!
> > > Using it with installers would be even better! Let me take a look at
> > > NBPackage and we'll continue the discussion .
> >
> > Great! This might be useful too -
> > https://github.com/neilcsmith-net/nbpackage-test  Built some test
> > installer / appimages of NetBeans last month, and these are the
> > configuration files (as well as the binaries under releases).
> >
> > Neil
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> > For additional commands, e-mail: dev-help@netbeans.apache.org
> >
> > For further information about the NetBeans mailing lists, visit:
> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

Re: How to bundle JDK with NetBeans

Posted by Lars Bruun-Hansen <lb...@gmail.com>.
Hi Zoran

It has indeed been possible for many years to bundle a JRE with a
NetBeans Platform installer.
It is documented here: https://dzone.com/articles/including-jre-in-nbi

The advantage is that you can simply distribute a single file to your
users which is an Installer executable (e.g. a .exe on Windows, a .sh
on Linux, etc). Inside the executable there will be a bundled JRE
which is silently unpacked and then used to launch the actual Java
code which forms your Installer logic. The same JRE can then also be
used for launching the application itself.

There's an annoying "bug" which means that you MUST re-package your
JRE bundle (say from Azul) using Info-ZIP and not some other archiving
tool. [NETBEANS-6228].

However: All of the above assume that you use NBI (NetBeans Installer)
with all of its Ant magic, convoluted way of working and lack of
documentation (IMO). It does work, though. But I can for sure applaud
Neil's effort to take a different route. I've struggled a lot with NBI
and - even if I was eventually successful - I'm not sure I can
recommend the experience.  :-)

/Lars


On Tue, Nov 23, 2021 at 4:14 PM Neil C Smith <ne...@apache.org> wrote:
>
> On Tue, 23 Nov 2021 at 15:06, Zoran Sevarac <se...@gmail.com> wrote:
> > Using jdkhome worked. Thanks!
> > Using it with installers would be even better! Let me take a look at
> > NBPackage and we'll continue the discussion .
>
> Great! This might be useful too -
> https://github.com/neilcsmith-net/nbpackage-test  Built some test
> installer / appimages of NetBeans last month, and these are the
> configuration files (as well as the binaries under releases).
>
> Neil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: How to bundle JDK with NetBeans

Posted by Neil C Smith <ne...@apache.org>.
On Tue, 23 Nov 2021 at 15:06, Zoran Sevarac <se...@gmail.com> wrote:
> Using jdkhome worked. Thanks!
> Using it with installers would be even better! Let me take a look at
> NBPackage and we'll continue the discussion .

Great! This might be useful too -
https://github.com/neilcsmith-net/nbpackage-test  Built some test
installer / appimages of NetBeans last month, and these are the
configuration files (as well as the binaries under releases).

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: How to bundle JDK with NetBeans

Posted by Zoran Sevarac <se...@gmail.com>.
Using jdkhome worked. Thanks!
Using it with installers would be even better! Let me take a look at
NBPackage and we'll continue the discussion .

Best
Zoran



On Tue, Nov 23, 2021 at 10:28 AM Neil C Smith <ne...@apache.org> wrote:

> On Tue, 23 Nov 2021 at 08:31, Zoran Sevarac <se...@gmail.com> wrote:
> > Is there any info about the best way to bundle OpenJDK with Netbeans
> > Platform Application?
> > I've tried setting on conf file
> > netbeans_jdkhome="zulu8.58.0.13-ca-jdk8.0.312-win_x64"
>
> Note that the platform and the IDE have different properties for this
> - you want to be using jdkhome.
>
> They also have different launchers that behave differently with this
> property - the IDE needs an absolute path, the platform can use a
> relative one.
>
> What's your build system?  I've got an Ant build that does this -
> particularly see
> https://github.com/praxis-live/praxis-live/blob/master/build.xml#L114
>
> As Geertjan mentioned, I'm working on a tool called NBPackage to build
> native packages / installers from a IDE or platform zip build, with
> optional JDK - this is at
>
> https://github.com/apache/netbeans-tools/pull/47
> https://github.com/neilcsmith-net/netbeans-tools/tree/nbpackage/nbpackage
>
> Because of the current different behaviour of the launchers, NBPackage
> uses other ways of bundling incidentally - eg. the InnoSetup installer
> sets --jdkhome in the parameters of the shortcut.
>
> On Tue, 23 Nov 2021 at 09:01, Zoran Sevarac <se...@gmail.com> wrote:
> > Great!
> > @Neil let me know if I can help.
>
> Absolutely!  Please do.  I've been tied up with the release recently,
> but discussion / help around NBPackage welcome, particularly with
> regard to RCP applications.  I intend to use for that as well, but
> testing so far been IDE centric.
>
> Best wishes,
>
> Neil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

-- 
Zoran Sevarac, PhD, Associate Professor
University of Belgrade, Faculty of Organisational Sciences, Department for
Software Engineering
Java Champion <https://community.oracle.com/community/java/java-champions>
| Oracle Groundbreaker Ambassador | Deep Netts <http://www.deepnetts.com>
Co-founder & CEO

Re: How to bundle JDK with NetBeans

Posted by Neil C Smith <ne...@apache.org>.
On Tue, 23 Nov 2021 at 08:31, Zoran Sevarac <se...@gmail.com> wrote:
> Is there any info about the best way to bundle OpenJDK with Netbeans
> Platform Application?
> I've tried setting on conf file
> netbeans_jdkhome="zulu8.58.0.13-ca-jdk8.0.312-win_x64"

Note that the platform and the IDE have different properties for this
- you want to be using jdkhome.

They also have different launchers that behave differently with this
property - the IDE needs an absolute path, the platform can use a
relative one.

What's your build system?  I've got an Ant build that does this -
particularly see
https://github.com/praxis-live/praxis-live/blob/master/build.xml#L114

As Geertjan mentioned, I'm working on a tool called NBPackage to build
native packages / installers from a IDE or platform zip build, with
optional JDK - this is at

https://github.com/apache/netbeans-tools/pull/47
https://github.com/neilcsmith-net/netbeans-tools/tree/nbpackage/nbpackage

Because of the current different behaviour of the launchers, NBPackage
uses other ways of bundling incidentally - eg. the InnoSetup installer
sets --jdkhome in the parameters of the shortcut.

On Tue, 23 Nov 2021 at 09:01, Zoran Sevarac <se...@gmail.com> wrote:
> Great!
> @Neil let me know if I can help.

Absolutely!  Please do.  I've been tied up with the release recently,
but discussion / help around NBPackage welcome, particularly with
regard to RCP applications.  I intend to use for that as well, but
testing so far been IDE centric.

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: How to bundle JDK with NetBeans

Posted by Zoran Sevarac <se...@gmail.com>.
Great!
@Neil let me know if I can help.

Best
,
Zoran

On Tue, Nov 23, 2021 at 9:35 AM Geertjan Wielenga
<ge...@googlemail.com.invalid> wrote:

> If Neil’s plan to bundle NetBeans with Zulu and make it available from his
> site succeeds, then Deep Netts and others should be able to reuse that
> somehow.
>
> Gj
>
> On Tue, 23 Nov 2021 at 09:31, Zoran Sevarac <se...@gmail.com> wrote:
>
> > Hi,
> >
> > Is there any info about the best way to bundle OpenJDK with Netbeans
> > Platform Application?
> > I've tried setting on conf file
> > netbeans_jdkhome="zulu8.58.0.13-ca-jdk8.0.312-win_x64"
> >
> > But when I run the app it keeps using the default jre (shown in About
> > dialog).
> > I've tried the absolute path with the same result.
> > Is it possible to specify which JRE NetBeans should use to run on?
> >
> > Thanks
> > Zoran
> >
> > --
> > Zoran Sevarac, PhD, Associate Professor
> > University of Belgrade, Faculty of Organisational Sciences, Department
> for
> > Software Engineering
> > Java Champion <
> https://community.oracle.com/community/java/java-champions>
> > | Oracle Groundbreaker Ambassador | Deep Netts <http://www.deepnetts.com
> >
> > Co-founder & CEO
> >
>


-- 
Zoran Sevarac, PhD, Associate Professor
University of Belgrade, Faculty of Organisational Sciences, Department for
Software Engineering
Java Champion <https://community.oracle.com/community/java/java-champions>
| Oracle Groundbreaker Ambassador | Deep Netts <http://www.deepnetts.com>
Co-founder & CEO

Re: How to bundle JDK with NetBeans

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
If Neil’s plan to bundle NetBeans with Zulu and make it available from his
site succeeds, then Deep Netts and others should be able to reuse that
somehow.

Gj

On Tue, 23 Nov 2021 at 09:31, Zoran Sevarac <se...@gmail.com> wrote:

> Hi,
>
> Is there any info about the best way to bundle OpenJDK with Netbeans
> Platform Application?
> I've tried setting on conf file
> netbeans_jdkhome="zulu8.58.0.13-ca-jdk8.0.312-win_x64"
>
> But when I run the app it keeps using the default jre (shown in About
> dialog).
> I've tried the absolute path with the same result.
> Is it possible to specify which JRE NetBeans should use to run on?
>
> Thanks
> Zoran
>
> --
> Zoran Sevarac, PhD, Associate Professor
> University of Belgrade, Faculty of Organisational Sciences, Department for
> Software Engineering
> Java Champion <https://community.oracle.com/community/java/java-champions>
> | Oracle Groundbreaker Ambassador | Deep Netts <http://www.deepnetts.com>
> Co-founder & CEO
>