Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: "Sorry, this version of QZ Tray cannot be installed on this system" #1095

Closed
tresf opened this issue Jan 31, 2023 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@tresf
Copy link
Contributor

tresf commented Jan 31, 2023

It appears that the Windows installer does not support diacritic characters in the user name.

Steps to reproduce:

  1. Create a user profile called Mišć with Administrator rights
  2. Download QZ Tray
  3. Try to install QZ Tray

The following error occurs:

Output folder: C:\Program Files\QZ Tray
Output folder: C:\Users\MI7D68~1\AppData\Local\Temp\nsyB11D.tmp\payload
Extracting...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Sorry, this version of QZ Tray cannot be installed on this system.

Workaround

  1. Install 7-zip
  2. Extract the QZ Tray installer using 7-zip, place it in C:\qz-temp-installer
  3. Open Command Prompt as Administrator
  4. Run the installer steps manually:
    cd C:\qz-temp-installer\
    runtime\bin\java.exe -jar qz-tray.jar install
    runtime\bin\java.exe -jar qz-tray.jar certgen
@tresf tresf added the bug label Jan 31, 2023
@tresf tresf added this to the 2.2.3 milestone Jan 31, 2023
@tresf
Copy link
Contributor Author

tresf commented Jan 31, 2023

2.1.6 is even worse:

"NSIS Error"
"Error launching installer"

image

@tresf
Copy link
Contributor Author

tresf commented Mar 20, 2023

Possible solution: https://stackoverflow.com/a/73775477/3196753

@tresf
Copy link
Contributor Author

tresf commented Mar 22, 2023

Thanks to a contributor on the JNA bug tracker, there's an experimental flag in Windows which will fix this called "Beta: Use Unicode UTF-8 for worldwide language support".

To enable this setting:

  • Time & Language
  • Language & Region
  • Administrative Language Settings
  • Change system locale
  • Click "Beta: Use Unicode UTF-8 for worldwide language support"
  • Reboot the machine

Note: This workaround will NOT fix usernames containing exclamation marks due to this bug.

@Vzor-
Copy link
Contributor

Vzor- commented Mar 24, 2023

This solution worked on my system with no further changed needed. I think we are pretty close to getting this working without that flag, but if this solution is acceptable there is no need to go further. I will stash my work-in-progress and write up some notes just in case we ever need to come back to this.

@tresf
Copy link
Contributor Author

tresf commented Mar 24, 2023

This solution worked on my system with no further changed needed.

Thanks for confirming.

I think we are pretty close to getting this working without that flag [...] I will stash my work-in-progress and write up some notes just in case we ever need to come back to this.

I assume you mean the Unicode true flag? Normally, this would be critical for our installer with non-ANSI characters, however by some stroke of luck, NSIS uses the old DOS "8.3" file paths, so the paths are all converted to ANSI-compatible paths.

This can be tested with the following code:

diff --git a/ant/windows/windows-installer.nsi.in b/ant/windows/windows-installer.nsi.in
index 9b8f80d..517dc86 100644
--- a/ant/windows/windows-installer.nsi.in
+++ b/ant/windows/windows-installer.nsi.in
@@ -1,3 +1,4 @@
+Unicode true
 !define MUI_BGCOLOR "SYSCLR:Window"
 !define MUI_TEXTCOLOR "SYSCLR:WindowText"
 !include MUI2.nsh
@@ -86,7 +87,15 @@ Section
     SetOutPath $INSTDIR
 
     ; Copy files to a temporary location
-    SetOutPath "$PLUGINSDIR\payload"
+    StrCpy $0 $PLUGINSDIR
+    System::Call 'kernel32::GetLongPathName(t r0, t .r1, i ${NSIS_MAX_STRLEN}) i .r2'
+    StrCmp $2 error +2
+    StrCpy $0 $1
+    ; DetailPrint $0 # will print C:\Program Files\NSIS, where supported
+    SetOutPath "$0\payload"

Produces this:

  Output folder: C:\Program Files\QZ Tray
+ Output folder: C:\Users\Mišć\AppData\Local\Temp\nsv7E44.tmp\payload

... as opposed to this: (Notice Mišć vs. MI7D68~1)

  Output folder: C:\Program Files\QZ Tray
+ Output folder: C:\Users\MI7D68~1\AppData\Local\Temp\nsd7602.tmp\payload

... however, due to an upstream bug with the way Java handles encoding, it the runtime cannot find all of the files required to function correctly.

If there's a future need to have Unicode support in the installers, we should be able to easily support this via the following patch:

diff --git a/ant/windows/installer.xml b/ant/windows/installer.xml
index 412c64c..3df40e3 100644
--- a/ant/windows/installer.xml
+++ b/ant/windows/installer.xml
@@ -62,6 +62,8 @@
 
         <!-- Create the exe -->
         <exec executable="${nsisbin}" failonerror="true">
+            <arg value="-INPUTCHARSET"/>
+            <arg value="UTF8"/>
             <arg value="${build.dir}/${nsis.script.out}"/>
         </exec>
 
diff --git a/ant/windows/windows-installer.nsi.in b/ant/windows/windows-installer.nsi.in
index 9b8f80d..d95a3fe 100644
--- a/ant/windows/windows-installer.nsi.in
+++ b/ant/windows/windows-installer.nsi.in
@@ -1,3 +1,4 @@
+Unicode true
 !define MUI_BGCOLOR "SYSCLR:Window"
 !define MUI_TEXTCOLOR "SYSCLR:WindowText"
 !include MUI2.nsh
diff --git a/ant/windows/windows-launcher.nsi.in b/ant/windows/windows-launcher.nsi.in
index 9051491..f02b0f2 100644
--- a/ant/windows/windows-launcher.nsi.in
+++ b/ant/windows/windows-launcher.nsi.in
@@ -1,3 +1,4 @@
+Unicode true
 !include x64.nsh
 !include LogicLib.nsh
 
diff --git a/ant/windows/windows-uninstaller.nsi.in b/ant/windows/windows-uninstaller.nsi.in
index e572ec1..8274066 100644
--- a/ant/windows/windows-uninstaller.nsi.in
+++ b/ant/windows/windows-uninstaller.nsi.in
@@ -1,3 +1,4 @@
+Unicode true
 !define MUI_BGCOLOR "SYSCLR:Window"
 !define MUI_TEXTCOLOR "SYSCLR:WindowText"
 !include MUI2.nsh

@tresf
Copy link
Contributor Author

tresf commented Mar 24, 2023

@tresf tresf closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants