JavaFX Native Packaging EXE on a Mac - windows

I am using Eclipse on Mac to develop my JavaFX application. I have packaged it as a dmg very nicely with the ant build and e(fx)clipse plugin.
However I now need to make this application an exe. Every tutorial and help I have found so far show that you need Inno Setup however this program is only available for Windows and I am on a Mac.
How should I go about this?
Any help is appreciated!

It is not possible, as documented at official oracle website:
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
Self-contained application packages have the following drawbacks:
Package per target platform: Self-contained application packages are platform-specific and can only be produced for the same system on
which you build. To deliver self-contained application packages on
Windows, Linux, and OS X, you must build your project on all three
platforms.
Creating native bundles/launchers is tied to internal tools calling local installed toolsets, so running any "EXE"-file would never work. An option would be to install a windows-system inside some virtual machine.
Some notes about "create 32bit on 64bit"-systems and vice-versa: it is tricky and not very possible, at least on windows-systems. I encountered this while debugging some issue of the javafx-maven-plugin (disclaimer: I am the maintainer of that maven-plugin)

Related

Is there a way to build the same JavaFX app to a .exe with different build types?

I need to build a javafx aplication to a .exe file, to be used in 3 differents enviroments.
Now, before I build the application to each different enviroment I am changing every variable manualy, like urls, versions and tokens. I know that is a matter of time until I upload the wrong version to the wrong enviroment, so I really need a more automatic process to manage each version.
I read something about maven build profiles but i do not find a way to integrate this in the building of the exe file
This javaFx app is using maven and java10
To build the java code to an exe, I'm using Intellij
Thank you in advance
The big problem is that java 10 is end of lifetime (EOL), so you should already work with java 11, this however is a little more complicated since JavaFx/OpenJfx is now separated. (see https://openjfx.io/)
Anyway to solve your complex needs you should think about a CI platform like as example gitlab CI.
This platforms (with the help of Docker Images) give you the tools you need to properly build and configure complex javaFX build targets and configurations.
But you have to build the .exe file on your own with tools like exe4j if you choose this path.
Side Tips:
In my experience is a lot more easy to build java 11 applications
with gradle instend of just maven since you gain a lot more
flexiblity to solve complex problems
If you stay on java 10 it would be much easier since Java11 + Openjfx
11 required OS dependend builds. (but as I sayed it is EOL)

installing electron app is too slow because of native dependencies that need installing into user end pc

I have an electron app with 2 package.json files.
The root/package.json has all devDependencies, and the root/app/package.json has all dependencies which is necessary for app running.
So I package app folder using electron-packager, then build installer for windows using inno setup.
But when I install the app, because the node_modules in app has too many dependencies, the installer is so slow in order to extract all contents from node_modules.
Other apps cost 3-10s for installing, but mine 25-35s.
So what should I do for this? Maybe I can bundle the js using webpack before packaging?
Thanks.
You should absolutely use something like webpack (or equivalent) to bundle your application. Webpack does an excellent job at tree-shaking your dependencies and only keeping the resultant necessary modules.
I have already posted a possible solution for electron projects, including a build process approach that leads to installation building. My particular recommendation leaned on utilizing Wix for MSI deployment but the build process items are still applicable (steps 1-6) for anyone wanting to understand a possible process for the items important to doing this work (even if you use another installer). Hope this helps:
https://stackoverflow.com/a/46474978/3946706
Are you packaging a web app into electron? The slow packaging time is probably because of bundling web node modules into the electron app which is not necessary.
https://medium.com/#hellobharadwaj/electron-plus-angular-react-why-use-2-different-package-json-files-361ae47d07f3

How do you handle maven builds with cross platform code and platform specific testing?

I have cross platform maven java build. I want to run the unit tests on each platforms but only need to compile/package/deploy from one platform.
For example:
checkout on windows
build-test-package-deploy
run unit-tests on other platforms using maven-repo
At present, I'm building and testing on all platform but this consumes resources and results in multiple generation of artifacts which seems wrong from a maven stand point.
How do you handle this situation?
Thanks
Peter
I currently have a cross platform build which needs to build on windows, 32bit ubuntu, 64bit ubuntu, and red hat. I develop on 32bit ubuntu and have profiles for all my target environments in the pom files. When I need to test builds I do it in a VM or yell at someone to check out a clean copy and try to build (preferred to make sure there isn't any machine-specific (env variables, local files, etc) stuff messing with it), although most of my code is fairly portable so my situation may not be super relevant for you.

How to make installer for Eclipse RCP

I would like to create installer for Eclipse RCP application. What is the best way to do this?
It is possible?
Eclipse Platform Version: 3.6.1
In a plug-in project, create a product configuration.
Configure it. On the Dependencies tab, the "Add required plug-ins" button is your friend.
Build the product -- e.g., through the "Exporting" section on the Overview tab.
Once it's built, you can build an installer with a third-party install tool compatible with the target operating system/s.
More detail is provided in the Eclipse FAQ under "How do I create an Eclipse product?"
There are two solutions that I know should make the job of creating an installer easy:
EclipseNSIS - which is windows-only
Use Pulse OneInstall - which seems to be cross-platform.
I have not used either of the above, but have been researching them as well. Both should have wizards that guide your through the above.

In continuous integration what is the best way to deal with external application dependencies

In using our TeamCity Continuous Integration server we have uncovered some issues that we are unsure as to the best way to handle. Namely how to reference external applications that our application requires on the CI server.
This was initially uncovered with a dependency on Crystal Reports, so we went and installed Crystal Reports on the Server fixing the immediate problem. However as we move more applications over to the CI server we are finding more dependencies.
What is the best strategy here? Is it to continue installing the required applications on the Server?
Thanks
Where possible make the external dependencies part of your build system.
For instance check the installer in to your version control system and have a step that checks it out and runs it in silent mode (many installers support a mode with no user action sometimes using the commandline /s).
This way if you need to set up another build machine for a branch or just for new hardware everything is repeatable.
If your builds require the actual application to complete the build, then you should probably continue to install the application on your build server.
If you just need references to dlls or assemblies from the application, then what we've done at my company is to create installable 'SDKs' of the references required for a particular applicatoin and install them on our development and build machines in well-known library directories that our solutions reference.
On the build machine, our pre-build steps install the correct version of the dependencies and then clean them up when we are finished.
Recently, we've moved to using virtual machines for our build machines that our build process activates. These VMs get the SDKs installed on them as a pre-build, and then are restored to their snap-shot state after the build. We had some dependencies that were almost impossible to uninstall, so this made for a clean starting point each time.
If you use Maven to build, you can define your dependencies in the pom.xml file. They will then be automatically downloaded if necessary.
I am not sure if I followed correctly...
I am assuming your application is dependent on this external app, while building? In that case it should be on the machine doing CI...

Resources