Re: NetBeans Platform "Golden Path"
On Mon, 12 Jul 2021 at 22:17, Emilian Bold wrote: > I don't think the Platform is opinionated about not including a JRE, Absolutely, in fact in some ways the opposite ... > NetBeans used to come as a JDK bundle in the Sun Microsystems and > Oracle days. So, all the plumbing is still there and in the conf file > is just a jdkhome to set. If I remember correctly, the bundles installed the JDK though? I don't think I ever used one. A key thing to add is that the jdk location in the conf file can be relative, so inside the application folder, and entirely local not "installed". And while the conf value may be called jdk, it can be a cut down (eg. jlink) runtime. All 3 OS versions of PraxisLIVE do this for InnoSetup installer, macOS app bundle and AppImage, the JDK is just unzipped inside an additional folder alongside bin, etc, and the other clusters. eg. https://github.com/praxis-live/praxis-live/blob/master/build.xml#L108 A while back I wrote a short bash script to create a NetBeans AppImage that does a similar thing, downloading the zip version of the IDE and a JDK. Only difference is it uses an additional simple launch script that passes --jdkhome if available. https://gist.github.com/neilcsmith-net/69bcb23bcc6698815438dc4e3df6caa3 I must update that for 12.4! Best wishes, Neil - To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: NetBeans Platform "Golden Path"
The Java Modules referred to there can simply be the modules of the JRE - not your application. I use jlink and jpackage all the time to package non-modular applications. I just have to select the Java modules of the JDK that the application needs. Since my application is non-modular, I can’t just point jlink at the app modules and have it figured out for me. Scott > On Jul 8, 2021, at 9:04 AM, Emma Atkinson wrote: > > > "The jlink tool links a set of modules, along with their transitive > dependencies, to create a custom runtime image." > > JPMS is necessary if you want to use jlink, according to the oracle manual. > It is the reason I am migrating my old programs to JPMS as and when the mood > takes me. > > >> On Thu, 8 Jul 2021, 13:50 Scott Palmer, wrote: >> Use of jlink and jpackage does NOT require that you use JPMS. >> >> I have never made a “modular” application using JPMS, but I use jpackage all >> the time (but I wasn’t making NetBeans platform apps). You just need to know >> which modules from the JDK to include in the runtime, assuming you don’t >> need all of them. >> >> In my projects I use a custom Gradle task to run jlink and jpackage. It >> might be more difficult with Maven, but it should be possible. >> >> Scott >> >> > Additionally, although recent developments like jlink and jpackage have >> > made it somewhat easier to produce stand-alone application bundles that >> > don't require the user to first install a JRE, which is nice, it seems >> > that these tools sometimes require the use of JPMS modules, which can be >> > problematic in NetBeans (see above). >> >> - >> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org >> For additional commands, e-mail: users-h...@netbeans.apache.org >> >> For further information about the NetBeans mailing lists, visit: >> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists >>
Re: NetBeans Platform "Golden Path"
I don't think the Platform is opinionated about not including a JRE, it's just that they can't under Apache. NetBeans used to come as a JDK bundle in the Sun Microsystems and Oracle days. So, all the plumbing is still there and in the conf file is just a jdkhome to set. It was relatively easy to include a JRE for Windows and macOS. --emi On Mon, Jul 12, 2021 at 10:22 PM Chris Marusich wrote: > > Hi everyone, > > Thank you very much for the thoughtful replies. It's very helpful to > hear about how others do things. > > It sounds like I am probably making my life more difficult than it needs > to be by choosing to use JPMS modules. Personally, I believe that as > JPMS modules are adopted more and more by the Java ecosystem, and as > everyone's Java version inexorably advances to Java 9 and beyond, it > will become harder and harder to avoid dealing with JPMS modules in > practice. Once you start using Java 9 or later, JPMS modules are there, > and even if you try to avoid them, you'll probably bump into some > problems related to automatic modules or unnamed modules or similar > eventually... However, for now I get the impression that avoiding JPMS > modules, if possible, is the path of least resistance in NetBeans. > Maybe the problems I've had with the nbm-maven-plugin were because I was > trying to explicitly make use of JPMS modules. I'll try again, this > time avoiding explicitly using JPMS modules if I can, and see how it > goes. > > Regarding how to build a stand-alone application: without the > convenience of jlink (because JPMS modules are definitely required, at > least in my specific case, to use jlink; it is possible that jlink can > work without JPMS modules in other specific circumstances, but in my > case that is not possible), I agree the only option is to probably > create a custom script that does the jobs. It's good to know that I'm > not missing something; that's about what I expected. > > Regarding the point about requiring a user to install Java separately, I > think sometimes it could be appropriate, and sometimes not. Personally, > I usually feel that it is an unnecessary hurdle and an additional > maintenance burden. My users shouldn't even need to know they're > running Java. It seems like a small thing, but it really is a > significant hurdle in some contexts. I could be wrong, but it sounds > like NetBeans Platform is pretty "opinionated" about this point, and it > basically encourages you to require the user to install the JRE > separately. However, I can see it isn't too hard to bundle a JRE > yourself with a custom script if you really want to. I'll probably try > to do that if I can. > > I appreciate all the helpful advice! > > -- > Chris - To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: NetBeans Platform "Golden Path"
Hi everyone, Thank you very much for the thoughtful replies. It's very helpful to hear about how others do things. It sounds like I am probably making my life more difficult than it needs to be by choosing to use JPMS modules. Personally, I believe that as JPMS modules are adopted more and more by the Java ecosystem, and as everyone's Java version inexorably advances to Java 9 and beyond, it will become harder and harder to avoid dealing with JPMS modules in practice. Once you start using Java 9 or later, JPMS modules are there, and even if you try to avoid them, you'll probably bump into some problems related to automatic modules or unnamed modules or similar eventually... However, for now I get the impression that avoiding JPMS modules, if possible, is the path of least resistance in NetBeans. Maybe the problems I've had with the nbm-maven-plugin were because I was trying to explicitly make use of JPMS modules. I'll try again, this time avoiding explicitly using JPMS modules if I can, and see how it goes. Regarding how to build a stand-alone application: without the convenience of jlink (because JPMS modules are definitely required, at least in my specific case, to use jlink; it is possible that jlink can work without JPMS modules in other specific circumstances, but in my case that is not possible), I agree the only option is to probably create a custom script that does the jobs. It's good to know that I'm not missing something; that's about what I expected. Regarding the point about requiring a user to install Java separately, I think sometimes it could be appropriate, and sometimes not. Personally, I usually feel that it is an unnecessary hurdle and an additional maintenance burden. My users shouldn't even need to know they're running Java. It seems like a small thing, but it really is a significant hurdle in some contexts. I could be wrong, but it sounds like NetBeans Platform is pretty "opinionated" about this point, and it basically encourages you to require the user to install the JRE separately. However, I can see it isn't too hard to bundle a JRE yourself with a custom script if you really want to. I'll probably try to do that if I can. I appreciate all the helpful advice! -- Chris signature.asc Description: PGP signature
Re: NetBeans Platform "Golden Path"
On Wed, 7 Jul 2021 at 21:19, Emilian Bold wrote: > 2. Use Maven and nbm-maven-plugin. ... > 4. Once you have a zip file with the launchers it's super easy to make > a macOS DMG and a Windows installer (using Inno Setup). Mostly agree with Emi, but despite using Maven for most things, I do still use Ant for some platform projects. There are some useful tasks in there, and customising the build/layout, or extending to do things like template an InnoSetup script and build the installer directly from the build script is quite easy. I guess it comes down to how "typical" your platform application will be. Best wishes, Neil - To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: NetBeans Platform "Golden Path"
"The jlink tool links a set of modules, along with their transitive dependencies, to create a custom runtime image." JPMS is necessary if you want to use jlink, according to the oracle manual. It is the reason I am migrating my old programs to JPMS as and when the mood takes me. On Thu, 8 Jul 2021, 13:50 Scott Palmer, wrote: > Use of jlink and jpackage does NOT require that you use JPMS. > > I have never made a “modular” application using JPMS, but I use jpackage > all the time (but I wasn’t making NetBeans platform apps). You just need to > know which modules from the JDK to include in the runtime, assuming you > don’t need all of them. > > In my projects I use a custom Gradle task to run jlink and jpackage. It > might be more difficult with Maven, but it should be possible. > > Scott > > > Additionally, although recent developments like jlink and jpackage have > made it somewhat easier to produce stand-alone application bundles that > don't require the user to first install a JRE, which is nice, it seems that > these tools sometimes require the use of JPMS modules, which can be > problematic in NetBeans (see above). > > - > To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org > For additional commands, e-mail: users-h...@netbeans.apache.org > > For further information about the NetBeans mailing lists, visit: > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > >
Re: NetBeans Platform "Golden Path"
Use of jlink and jpackage does NOT require that you use JPMS. I have never made a “modular” application using JPMS, but I use jpackage all the time (but I wasn’t making NetBeans platform apps). You just need to know which modules from the JDK to include in the runtime, assuming you don’t need all of them. In my projects I use a custom Gradle task to run jlink and jpackage. It might be more difficult with Maven, but it should be possible. Scott > Additionally, although recent developments like jlink and jpackage have made > it somewhat easier to produce stand-alone application bundles that don't > require the user to first install a JRE, which is nice, it seems that these > tools sometimes require the use of JPMS modules, which can be problematic in > NetBeans (see above). - To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
RE: NetBeans Platform "Golden Path"
I agree with everything Emilian said in the other post. My own experience: 1) I have never tried JPMS. 2) Yes, maven-based NetBeans Platform projects work great. I switched my NetBeans Platform project to Maven several years ago, and haven't had any problems with it compared to ant. 3) Yes, each external library must be wrapped in a NetBeans wrapper module (which is usually just a folder with one pom.xml file and one manifest.mf file). Usually there is no need to download the JAR manually, if Maven can find it. 4) In my case I have a custom script which generates a ZIP file for distribution of the application for Linux, a ZIP file for Windows, and a DMG file with an application bundle for MacOS. The script uses the ZIP file generated from the NetBeans Platform build as its input. It also copies in a platform-appropriate JRE for each OS, and points the netbeans.conf (or myapp.conf or whatnot) file to it. I never used the NetBeans-generated installers, although at some point I'll want to figure out how to build a proper installer on Windows. Though I might look into building an MSI rather than an EXE installer there. In recent Java versions, you need to use the jlink command to generate a customized JRE from the JDK (which involves figuring out which JDK modules your applications needs). When bundling a JRE/JDK, avoid using the Oracle one, as it has some unpleasant license terms--you can use e.g. Zulu's JDK distro instead. On MacOS it is now more-or-less mandatory to "notarize" the application bundle before distributing it. This requires an Apple developer subscription and a MacOS machine. I have never used jpackage. -- Eirik https://twitter.com/ultorg -Original Message- From: Chris Marusich Sent: Wednesday, July 7, 2021 9:24 PM To: users@netbeans.apache.org Subject: NetBeans Platform "Golden Path" Hi, What's the current "best practice" or "golden path" for building and distributing a NetBeans Platform application and managing its dependencies (e.g., from Maven central)? That's a big general question, so I'll ask some specifics: - Should I ever try to use JPMS modules when building a NetBeans Platform application? I've found that in my projects (which are NetBeans Maven-based projects, not NetBeans Platform projects), when I use JPMS modules, it can cause problems for NetBeans [1], so I wonder if it's really wise to even try mixing JPMS modules with NetBeans projects at this time, let alone NetBeans Platform projects. - Should I ever try to make a Maven-based NetBeans Platform application? I see there are Maven templates in NetBeans that offer to create a Maven-based NetBeans Platform project. However, all the examples online and in books that I've seen so far do NOT use Maven. In spite of this, recent emails on this list have suggested that Maven-based NetBeans projects are generally preferred over the older Ant-based project types. So I'm a bit confused about what the currently prevailing wisdom on this matter is, in the case of NetBeans Platform projects. Perhaps Maven can be used to build NetBeans Platform applications/modules or not, depending on the situation. As a beginner in the world of NetBeans Platform, I just want to try making a NetBeans Platform project using whatever approach is more likely to work without trouble and remain supported by the community. But what approach might that be? - If I want to use a library that is available from Maven central in my NetBeans Platform application, is the best option to just manually download the JAR file, manually create a NetBeans Platform "wrapper module" for the JAR, and then use the "wrapper module" in my application? I tried using the nbm-maven-plugin to use dependencies from Maven in a simple NetBeans Platform application, but I encountered problems and couldn't figure out how to get it to work. So to me it feels like the answer to this question is "yes, at the moment you should manage your JARs manually in order to have the best developer experience when working on a NetBeans Platform application," but I'm not sure. I'm curious to hear the opinions of people who have more experience with the NetBeans Platform. - If I want to build a stand-alone release of my NetBeans Platform application that I can distribute to an end user, what's a good way to do it? It seems that some of the features in NetBeans that build a stand-alone release will only work when your project is not a Maven-based NetBeans Platform application. Additionally, although recent developments like jlink and jpackage have made it somewhat easier to produce stand-alone application bundles that don't require the user to first install a JRE, which is nice, it seems that these tools sometimes require the use of JPMS modules, which can be problematic in NetBeans (see above). And in any case NetBeans does not yet seem to expose any way to take advantage of these new tools. So what IS the most common
Re: NetBeans Platform "Golden Path"
Chris, I devevelop an Ant-based Netbeans platform application (https://github.com/jjazzboss/JJazzLab-X) and had to follow this path too. I use only 2 external libraries that are packed in wrapper modules. I let Netbeans build the launchers and I have a shell script that prepare the packages for each OS, bundling a JRE (I was hesitant at first, it adds ~40MB, but in the end it works well, most of my users don't even know it's a Java app), using Innosetup with code signing for Win, and zip for Linux and Mac. Jerome Le mercredi 7 juillet 2021 à 21:24:30 UTC+2, Chris Marusich a écrit : Hi, What's the current "best practice" or "golden path" for building and distributing a NetBeans Platform application and managing its dependencies (e.g., from Maven central)? That's a big general question, so I'll ask some specifics: - Should I ever try to use JPMS modules when building a NetBeans Platform application? I've found that in my projects (which are NetBeans Maven-based projects, not NetBeans Platform projects), when I use JPMS modules, it can cause problems for NetBeans [1], so I wonder if it's really wise to even try mixing JPMS modules with NetBeans projects at this time, let alone NetBeans Platform projects. - Should I ever try to make a Maven-based NetBeans Platform application? I see there are Maven templates in NetBeans that offer to create a Maven-based NetBeans Platform project. However, all the examples online and in books that I've seen so far do NOT use Maven. In spite of this, recent emails on this list have suggested that Maven-based NetBeans projects are generally preferred over the older Ant-based project types. So I'm a bit confused about what the currently prevailing wisdom on this matter is, in the case of NetBeans Platform projects. Perhaps Maven can be used to build NetBeans Platform applications/modules or not, depending on the situation. As a beginner in the world of NetBeans Platform, I just want to try making a NetBeans Platform project using whatever approach is more likely to work without trouble and remain supported by the community. But what approach might that be? - If I want to use a library that is available from Maven central in my NetBeans Platform application, is the best option to just manually download the JAR file, manually create a NetBeans Platform "wrapper module" for the JAR, and then use the "wrapper module" in my application? I tried using the nbm-maven-plugin to use dependencies from Maven in a simple NetBeans Platform application, but I encountered problems and couldn't figure out how to get it to work. So to me it feels like the answer to this question is "yes, at the moment you should manage your JARs manually in order to have the best developer experience when working on a NetBeans Platform application," but I'm not sure. I'm curious to hear the opinions of people who have more experience with the NetBeans Platform. - If I want to build a stand-alone release of my NetBeans Platform application that I can distribute to an end user, what's a good way to do it? It seems that some of the features in NetBeans that build a stand-alone release will only work when your project is not a Maven-based NetBeans Platform application. Additionally, although recent developments like jlink and jpackage have made it somewhat easier to produce stand-alone application bundles that don't require the user to first install a JRE, which is nice, it seems that these tools sometimes require the use of JPMS modules, which can be problematic in NetBeans (see above). And in any case NetBeans does not yet seem to expose any way to take advantage of these new tools. So what IS the most common way that people build a release version of a NetBeans Platform application, anyway? Ultimately, I just don't understand what the current "best practice" or "golden path" is for using NetBeans Platform. I'd like to know, though. I am happy to help improve the tutorials, but the problem is that even after reading various tutorials and documentation, and even after experimenting quite a bit on my own, I don't even understand what the path of least resistance is supposed to be. Footnotes: [1] http://mail-archives.apache.org/mod_mbox/netbeans-users/202010.mbox/%3c87sg9wgt19@gmail.com%3E -- Chris
Re: NetBeans Platform "Golden Path"
1. Don't use JPMS 2. Use Maven and nbm-maven-plugin. Documentation isn't the best but you can do most things with it including wrapping jars (ie. Maven Central dependencies), doing branding, doing the app. 3. I don't think anybody looked into using jlink/jpackage (which probably would need JPMS, no?) so your baseline for the release is the ZIP file 4. Once you have a zip file with the launchers it's super easy to make a macOS DMG and a Windows installer (using Inno Setup). 5. Pay Apple the $99 to sign/notarize the DMG and some Windows vendor the price of a code signing certificate (max $300 for the extended one). My 2c, --emi On Wed, Jul 7, 2021 at 10:24 PM Chris Marusich wrote: > > Hi, > > What's the current "best practice" or "golden path" for building and > distributing a NetBeans Platform application and managing its > dependencies (e.g., from Maven central)? That's a big general question, > so I'll ask some specifics: > > - Should I ever try to use JPMS modules when building a NetBeans > Platform application? I've found that in my projects (which are > NetBeans Maven-based projects, not NetBeans Platform projects), when I > use JPMS modules, it can cause problems for NetBeans [1], so I wonder if > it's really wise to even try mixing JPMS modules with NetBeans projects > at this time, let alone NetBeans Platform projects. > > - Should I ever try to make a Maven-based NetBeans Platform application? > I see there are Maven templates in NetBeans that offer to create a > Maven-based NetBeans Platform project. However, all the examples online > and in books that I've seen so far do NOT use Maven. In spite of this, > recent emails on this list have suggested that Maven-based NetBeans > projects are generally preferred over the older Ant-based project types. > So I'm a bit confused about what the currently prevailing wisdom on this > matter is, in the case of NetBeans Platform projects. Perhaps Maven can > be used to build NetBeans Platform applications/modules or not, > depending on the situation. As a beginner in the world of NetBeans > Platform, I just want to try making a NetBeans Platform project using > whatever approach is more likely to work without trouble and remain > supported by the community. But what approach might that be? > > - If I want to use a library that is available from Maven central in my > NetBeans Platform application, is the best option to just manually > download the JAR file, manually create a NetBeans Platform "wrapper > module" for the JAR, and then use the "wrapper module" in my > application? I tried using the nbm-maven-plugin to use dependencies > from Maven in a simple NetBeans Platform application, but I encountered > problems and couldn't figure out how to get it to work. So to me it > feels like the answer to this question is "yes, at the moment you should > manage your JARs manually in order to have the best developer experience > when working on a NetBeans Platform application," but I'm not sure. I'm > curious to hear the opinions of people who have more experience with the > NetBeans Platform. > > - If I want to build a stand-alone release of my NetBeans Platform > application that I can distribute to an end user, what's a good way to > do it? It seems that some of the features in NetBeans that build a > stand-alone release will only work when your project is not a > Maven-based NetBeans Platform application. Additionally, although > recent developments like jlink and jpackage have made it somewhat easier > to produce stand-alone application bundles that don't require the user > to first install a JRE, which is nice, it seems that these tools > sometimes require the use of JPMS modules, which can be problematic in > NetBeans (see above). And in any case NetBeans does not yet seem to > expose any way to take advantage of these new tools. So what IS the > most common way that people build a release version of a NetBeans > Platform application, anyway? > > Ultimately, I just don't understand what the current "best practice" or > "golden path" is for using NetBeans Platform. I'd like to know, though. > I am happy to help improve the tutorials, but the problem is that even > after reading various tutorials and documentation, and even after > experimenting quite a bit on my own, I don't even understand what the > path of least resistance is supposed to be. > > Footnotes: > [1] > http://mail-archives.apache.org/mod_mbox/netbeans-users/202010.mbox/%3c87sg9wgt19@gmail.com%3E > > -- > Chris - To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists