jDiskMark / jdm-java

1 stars 0 forks source link

Installer for Windows #14

Open jamesmarkchan opened 9 months ago

jamesmarkchan commented 9 months ago

A native installer for the current version of Windows.

This is ideally an msi or exe file and will allow clean install and uninstall of the jdiskmark program following platform best practices.

As a major convenience a windows installer would make it much easier for users to install and launch. This way user would not need to bother with:

  1. Downloading java 21 installer
  2. Installing java 21
  3. Downloading jDiskMark release
  4. unzipping the archive
  5. navigating to the unzip directory
  6. launching an administrative shell

It would just be:

  1. downloading the installer
  2. installing
  3. launching jdiskmark from start menu.

Issues:

  1. Duplicate names on SmartScreen - This is because the CN (common name) and O (organization) are the same and are combined in the Subject value field.
  2. Different MSI name used - Trying stack overflow community: https://stackoverflow.com/questions/78055873/how-to-set-title-or-displayed-msi-file-in-jpackage-install-dialog
  3. UAC - Publisher unknown when running as admin - The jpackage generated .exe is not signed. -> investigating with SignMyCode - Meetup is Friday 15th 5pm pst.
jamesmarkchan commented 8 months ago

jpackage is available in java21: https://docs.oracle.com/en/java/javase/21/docs/specs/man/jpackage.html jpackage --type msi --input . --main-jar myapp.jar --name

jamesmarkchan commented 8 months ago

hmmm:

C:\Users\james\NetBeansProjects\jdm-java\dist\jdiskmark-v0.5.1>"\Program Files\java\jdk-21\bin\jpackage" --type msi --input . --main-jar jDiskMark.jar --name jDiskMark --app-version 0.5.1
[23:57:31.361] Can not find WiX tools (light.exe, candle.exe)
[23:57:31.362] Download WiX 3.0 or later from https://wixtoolset.org and add it to the PATH.
Error: Invalid or unsupported type: [msi]
jamesmarkchan commented 8 months ago

Looks like there is a compatibility issue with wix version 4, i have both installed on my system atm but am adjusting the path to the v3 bins to be first. Version 3 of wix can be retrieved from here: https://github.com/wixtoolset/wix3/releases/tag/wix314rtm

I took the wix314.exe version (updated 2 weeks ago) and clicked the install option: image

NOTE: avoid installing with: C:\Users\james>dotnet tool install --global wix because it is installing version 4 with compatibility issues:

C:\Users\james>wix --version
4.0.4+a8592982
jamesmarkchan commented 8 months ago

Ran the generated installer and it shows up here: image

jamesmarkchan commented 8 months ago

inno setup allows creating installers where the program can run as admin on windows. https://jrsoftware.org/isdl.php#stable

jamesmarkchan commented 8 months ago

So issues with this so far with a signed certificate

  1. duplicate names when triggering smart screen smart-screen-duplicate-names
  2. unknown msi file referenced at install uap-unknown-msi-full
  3. running as admin shows unknown publisher unkn-pub-run-as-admin
jamesmarkchan commented 8 months ago

For reference here is the install dialogue for OrcaPXL_20240225_112219177.jpg

And the uninstall dialogue PXL_20240225_114256020.jpg

jamesmarkchan commented 8 months ago

Here is the USP uninstall dialogue: PXL_20240225_114037883.jpg

jamesmarkchan commented 8 months ago

attempting a question on stackoverflow: https://stackoverflow.com/questions/78055873/how-to-set-title-or-displayed-msi-file-in-jpackage-install-dialog

jamesmarkchan commented 8 months ago

note to self: https://docs.oracle.com/en/java/javase/21/jpackage/packaging-overview.html#GUID-E0966C49-ABBB-46A2-8DF7-1D3F96640F05

from ca:

Also, please try to use the following command to sign the exe file: signtool sign /tr http://timestamp.sectigo.com/ /td sha256 /fd sha256 /sha1 e4bd3eb6e8e75a0aa966d1e1eaba4db59a84dcc2 "C:\path\to\fileToSign.exe"