Protection against a too old Java platform
hbitteur opened this issue · 6 comments
Audiveris web page states clearly that it needs a certain Java platform underneath (Java 17 as of this writing).
But we keep seing posts about a terminal opening and closing before the user has any chance to read the error messages it contains.
We should investigate whether the launching Audiveris.bat
file could use some modal dialog to call user attention, and keep the terminal open, if the Java version check is not OK.
Could someone provide a hint on how to implement this?
After some googling, I think we could use in Audiveris.bat
something like:
start cmd /k "@echo off & mode con cols=50 lines=20 & echo ** & echo ** My Popup Message & echo ** "
This works if the .bat file is run from cmd.exe
.
Not from a bash
shell, or a Windows PowerShell.
Another solution is needed for them ...
Also: Audiveris.bat
file and Audiveris
(sh) file are generated during the building of the Windows installer (via makensis.exe).
I need a way to insert the Java version test there ...
How about msg %USERNAME% "Java too old!"
?
How about
msg %USERNAME% "Java too old!"
?
Sure!
This was just a mention of possible technique.
The content of the actual message would be more precise of course.
It will contain at least the required Java version and the version of Java actually used.
I don't think the username is relevant, because the message is meant to be displayed to the user who is reading the msg! :-)
More seriously, there is another difficulty: both Audiveris.bat
and Audiveris
(sh) command files are automatically generated by the NSIS compiler. Rather than post-editing these files manually, I will look for a way to specify the test in the inputs read by NSIS.
msg %USERNAME% "Java too old!"
The msg
command is not available in plain Windows versions.
C:\Users\herve>msg toto
'msg' is not recognized as an internal or external command,
operable program or batch file.
The
msg
command is not available in plain Windows versions.
Ah, sorry for this. I'm running Windows Pro.
By the way, according to the docs, msg
needs some "target" as the first argument, that's why I've put %USERNAME%
there; however, this seems to work only in the standard cmd
, for PowerShell, $ENV:UserName
has to be used instead. What a mess.
Problem solved via the commit f925084
It uses custom versions of both the Unix and Windows start scripts templates.
If the user now calls either Audiveris.bat
or Audiveris
(bash) start file, the Java version is dynamically checked and a (persistent) warning is made.
This applies to the Windows installed application, as well as the scripts included in the Gradle distributions.