Page MenuHomePhabricator

Find a solution that creates a Windows executable
Closed, ResolvedPublic16 Estimated Story Points

Description

This is just to see what works and what doesn't and will use example and/or simple programs, not Pattypan. The resulting executables will be tested on a virtual machine running Windows.

Candidates

SolutionResultWorks?Latest updateSize, download[/installed]Notes
build-jpackageInstallerYes2020-12-0547 / 123 MB
maven-jpackage-templateInstallerYes2022-10-1140 / 58 MB
WarpExecutableNo2019-07-12184 MB
launch4jExecutableYes2022-11-13Only for Windows.
GluonExecutableNo
7-zip (1, 2)ExecutableYes34-45 MBOnly for Windows.

Event Timeline

Found a solution that should create a executable, rather than an installation file: https://github.com/dgiagio/warp#quickstart-with-java.

Tested build-jpackage and maven-jpackage-template. Releases for both install and run.

I ran the Warp example and it worked on Linux. I had to change the version of the JRE to match the installed version used to compile the JAR.

Tried Gluon, but the release on Github didn't run. MSVCP140.dll was not found.

...there were actually two more DLLs missing.

Managed to create an EXE with Warp by borrowing a few things from other instructions and using Windows JRE.

run.cmd
@ECHO OFF

SETLOCAL

SET "JAVA_EXE=%~dp0\jre\bin\java.exe"
SET "APP_MAIN_PATH=%~dp0\%APP_MAIN_JS%"

CALL %JAVA_EXE% -jar %APP_MAIN_PATH%\app.jar
EXIT /B %ERRORLEVEL%
$ ./warp-packer --arch windows-x64 --input_dir bundle --exec run.cmd --output app.exe

This can be done on Linux.

Sebastian_Berlin-WMSE added a subscriber: Lokal_Profil.

After discussion with @Lokal_Profil, we decided that maven-jpackage-template is the most promising solution.

After discussion with @Lokal_Profil, we decided that maven-jpackage-template is the most promising solution.

Just double-checking with Abes that they are fine with an -msi installer rahter than an .exe one

It seems that an executable is what is required, so we'll have another look at a solution for that.

Sebastian_Berlin-WMSE changed the point value for this task from 4 to 16.Dec 5 2022, 9:25 AM

I encountered an error when running a Warp executable:

'C:\Users\IEUser\AppData\Local\warp\packages\app.exe\run.cmd' is not recognized as an internal or external command, operable program or batch file.

It's unclear when and why this happens, but it means this is not a reliable method.

I've been looking for a way to bundle JRE using Launch4j, but there doesn't seem to make it completely self contained. See e.g. https://stackoverflow.com/questions/13996547/how-do-i-bundle-a-jre-into-an-exe-for-a-java-application-launch4j-says-runtime where the solutions end up having JRE alongside the EXE.

I found a script that uses 7zip to create an EXE file that extracts and runs a BAT file. Including the Pattypan JAR and OpenJDK was enough to get it running. Everything is extracted to a temporary directory before running and nothing is installed.

I occasionally had an error about the file being corrupt when running, but running again tend to work. Not sure if it's caused by this method or the quite unstable virtual machine I'm running.

There's also a popup that says something about installation failing after the EXE has run. It's a bit odd, but doesn't cause any trouble and goes away if you click on the everything-is-fine button.