![]() Writing your own Java Launcher was only a consideration before I discovered Exe4j (distinct from the considerably more expensive Install4j), and found some old C code that looked like a feasible starting point. I may try again with Java packager on Windows in the near future – maybe I missed something. Java packager worked but was hard to configure (on Windows only – the Mac version works well) and the generated runtime and directory structure was messy, IMHO. Write your own Java Launcher (an ancient, but useful article here)Īfter some experimentation, I chose Exe4j because it was inexpensive, and supported Java 9 modules.Java Packager (Windows backport for JDK 11 here).Now that the application is ready, we want to create a proper Windows executable. The installBuild directory should now look like this:Īpp3 running on Windows 10 Step 4 – Create the Executable You need to make sure you did not miss any modules. Run it from the git repository root directory: gradlew buildRuntimeĪfter it’s done, that’s it – nothing more to do, other than to test it. This task puts the runtime into the installBuild/jre directory. I have wrapped the jlink call into the buildRuntime task. It requires a list of modules your application requires and can even generate a launcher script. To generate a custom java runtime, we use the JDK jlink tool. It is a single line of text: java.xml,sktop,java.scripting,java.logging,javafx.base,aphics,ntrols,javafx.fxml Step 3c – Generate the Custom Java Runtime So I added all the red modules (excluding java.base as that is an implied dependency of all modules) from previous step into dependencies.txt – you don’t need to. I put it in a file for simplicity, as parsing the jdeps output is a manual process for now. The file dependencies.txt in the repo root directory contains a list of dependencies. Since my app is a non-modular one, I suspect that is why the output is not a single, tidy list of modules. At the end add all the red modules to the dependencies.txt file. Since this is a dependency graph, you just traverse each entry from left to right until you hit a JDK module not on your mental list. The highlighted modules will be needed for the next step. You will get output as shown below (red highlights are mine). When you run this task the output is a bit messy, and you need to ‘pick out’ the modules from the list I have wrapped this in the gradle task called listModules. This can be done with the JDK jdeps utility. We need to get a list of java 9 modules that the application and it’s dependencies use. After this stage is completed, the installBuild directory should have everything required to start the application. We now need to add the embedded custom java runtime to the installBuild directory. I prefer having the application jar file sitting on its own, rather than with the other jar files. For the Mac process shown below, the java packager used is a backport provided by Gluon that works with JDK 11 onwards. ![]() I will talk about the Windows process in this post. An executable that behaves like a Windows applicationīelow is the process for Windows and Mac.Ability to package non-modular java applications.an embedded JDK11+ custom runtime (and therefore using Java 9 modules).The GoalĬreate an Windows 8+ installer for my JavaFX demo app 3 with: ![]() A standard license is 69 USD, and no, I don’t work there. I came up with a workable solution, after a lot of trial and error, aided by some good blog posts here and here.Ĭaveat: This approach relies on Exe4j – a commercial product, but you can work with the free demo version. The Mac process was relatively painless but the Windows process was another story altogether. J-Link is available in our store, just go to the homepage and search for it.After finishing the development of my current project, I started on the final task – building the installers. If you have any questions, please feel free to leave a comment.įor more information please go to Anet Community: And the driver can be seen in device manager section after being successfully installed Connect J-Link-OB to the computer with a USB cable, it will remind to install a driver. It means that J-Link ARM and J-Flash Arm are successfully installed.ġ0.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |