33# #
44# universalJavaApplicationStub #
55# #
6- # A BASH based JavaApplicationStub for Java Apps on MacOS #
6+ # A BASH based JavaApplicationStub for Java Apps on Mac OS X #
77# that works with both Apple's and Oracle's plist format. #
88# #
99# Inspired by Ian Roberts stackoverflow answer #
1010# at http://stackoverflow.com/a/17546508/1128689 #
1111# #
1212# @author Tobias Fischer #
1313# @url https://github.com/tofi86/universalJavaApplicationStub #
14- # @date 2021 -02-21 #
15- # @version 3.2 .0 #
14+ # @date 2023 -02-04 #
15+ # @version 3.3 .0 #
1616# #
1717# #################################################################################
1818# #
1919# The MIT License (MIT) #
2020# #
21- # Copyright (c) 2014-2021 Tobias Fischer #
21+ # Copyright (c) 2014-2023 Tobias Fischer #
2222# #
2323# Permission is hereby granted, free of charge, to any person obtaining a copy #
2424# of this software and associated documentation files (the "Software"), to deal #
@@ -246,6 +246,7 @@ if [ $exitcode -eq 0 ]; then
246246
247247 # read options file name
248248 JVMOptionsFile=$( plist_get_java ' :JVMOptionsFile' )
249+ JVMOptionsFile=$( eval echo " ${JVMOptionsFile} " )
249250
250251 # read bootstrap script file name
251252 BootstrapScript=$( plist_get_java ' :BootstrapScript' )
313314
314315 # read options file name
315316 JVMOptionsFile=$( plist_get ' :JVMOptionsFile' )
317+ JVMOptionsFile=$( eval echo " ${JVMOptionsFile} " )
316318
317319 # read bootstrap script file name
318320 BootstrapScript=$( plist_get ' :BootstrapScript' )
360362# ###########################################
361363
362364# supported languages / available translations
363- stubLanguages=" ^(fr|de|zh|es|en)- "
365+ stubLanguages=( " de " " en " " es " " fr " " pt-BR " " zh " )
364366
365367# read user preferred languages as defined in macOS System Preferences (#101)
366368stub_logger ' [LanguageSearch] Checking preferred languages in macOS System Preferences...'
@@ -371,15 +373,19 @@ language=""
371373for i in " ${appleLanguages[@]} "
372374do
373375 langValue=" ${i% -* } "
374- if [[ " $i " =~ $stubLanguages ]]; then
375- stub_logger " [LanguageSearch] ... selected '$i ' ('$langValue ') as the default language for the launcher stub"
376+ if [[ " ${stubLanguages[*]} " =~ " ${i} " ]]; then
377+ stub_logger " [LanguageSearch] ... selected '$i ' as the default language for the launcher stub"
378+ language=${i}
379+ break
380+ elif [[ " ${stubLanguages[*]} " =~ " ${langValue} " ]]; then
381+ stub_logger " [LanguageSearch] ... selected '$langValue ' (from '$i ') as the default language for the launcher stub"
376382 language=${langValue}
377- break
383+ break
378384 fi
379385done
380386if [ -z " ${language} " ]; then
381- language=" en"
382- stub_logger " [LanguageSearch] ... selected fallback 'en' as the default language for the launcher stub"
387+ language=" en"
388+ stub_logger " [LanguageSearch] ... selected fallback 'en' as the default language for the launcher stub"
383389fi
384390stub_logger " [Language] $language "
385391
398404 MSG_INSTALL_JAVA=" Java doit être installé sur votre système.\nRendez-vous sur java.com et suivez les instructions d'installation..."
399405 MSG_LATER=" Plus tard"
400406 MSG_VISIT_JAVA_DOT_COM=" Java by Oracle"
401- MSG_VISIT_ADOPTOPENJDK =" Java by AdoptOpenJDK "
407+ MSG_VISIT_ADOPTIUM =" Java by Adoptium "
402408 ;;
403409
404410# German
414420 MSG_INSTALL_JAVA=" Auf Ihrem System muss die 'Java'-Software installiert sein.\nBesuchen Sie java.com für weitere Installationshinweise."
415421 MSG_LATER=" Später"
416422 MSG_VISIT_JAVA_DOT_COM=" Java von Oracle"
417- MSG_VISIT_ADOPTOPENJDK =" Java von AdoptOpenJDK "
423+ MSG_VISIT_ADOPTIUM =" Java von Adoptium "
418424 ;;
419425
420426# Simplified Chinese
430436 MSG_INSTALL_JAVA=" 你需要在Mac中安装Java运行环境!\n访问 java.com 了解如何安装。"
431437 MSG_LATER=" 稍后"
432438 MSG_VISIT_JAVA_DOT_COM=" Java by Oracle"
433- MSG_VISIT_ADOPTOPENJDK =" Java by AdoptOpenJDK "
439+ MSG_VISIT_ADOPTIUM =" Java by Adoptium "
434440 ;;
435441
436442# Spanish
446452 MSG_INSTALL_JAVA=" ¡Necesita tener JAVA instalado en su Mac!\nVisite java.com para consultar las instrucciones para su instalación..."
447453 MSG_LATER=" Más tarde"
448454 MSG_VISIT_JAVA_DOT_COM=" Java de Oracle"
449- MSG_VISIT_ADOPTOPENJDK =" Java de AdoptOpenJDK "
455+ MSG_VISIT_ADOPTIUM =" Java de Adoptium "
450456 ;;
451457
458+ # Brazilian Portuguese
459+ pt-BR)
460+ MSG_ERROR_LAUNCHING=" ERRO iniciando '${CFBundleName} '."
461+ MSG_MISSING_MAINCLASS=" 'MainClass' não foi definida!\nA aplicação java não poderá ser iniciada!"
462+ MSG_JVMVERSION_REQ_INVALID=" A sintaxe da versão Java requerida não é valida: %s\nPor favor contacte o desenvolvedor dessa aplicação."
463+ MSG_NO_SUITABLE_JAVA=" Não foi encontrado uma versão Java compatível no seu sistema!\nEsta aplicação precisa do Java %s"
464+ MSG_JAVA_VERSION_OR_LATER=" ou maior"
465+ MSG_JAVA_VERSION_LATEST=" (última atualização)"
466+ MSG_JAVA_VERSION_MAX=" máxima %s"
467+ MSG_NO_SUITABLE_JAVA_CHECK=" Verifique se instalou a versão Java necessária."
468+ MSG_INSTALL_JAVA=" Você precisa instalar o JAVA no seu Mac!\nPor favor, visite java.com para instruções de instalação..."
469+ MSG_LATER=" Depois"
470+ MSG_VISIT_JAVA_DOT_COM=" Java por Oracle"
471+ MSG_VISIT_ADOPTIUM=" Java por Adoptium"
472+ ;;
473+
452474# English | default
453475en|* )
454476 MSG_ERROR_LAUNCHING=" ERROR launching '${CFBundleName} '."
@@ -462,7 +484,7 @@ en|*)
462484 MSG_INSTALL_JAVA=" You need to have JAVA installed on your Mac!\nVisit java.com for installation instructions..."
463485 MSG_LATER=" Later"
464486 MSG_VISIT_JAVA_DOT_COM=" Java by Oracle"
465- MSG_VISIT_ADOPTOPENJDK =" Java by AdoptOpenJDK "
487+ MSG_VISIT_ADOPTIUM =" Java by Adoptium "
466488 ;;
467489esac
468490
@@ -828,21 +850,21 @@ if [ -z "${JAVACMD}" ] || [ ! -x "${JAVACMD}" ] ; then
828850 stub_logger " [EXIT 3] ${MSG_NO_SUITABLE_JAVA_EXPANDED} "
829851
830852 # display error message with AppleScript
831- osascript -e " tell application \" System Events\" to display dialog \" ${MSG_ERROR_LAUNCHING} \n\n${MSG_NO_SUITABLE_JAVA_EXPANDED} \n${MSG_NO_SUITABLE_JAVA_CHECK} \" with title \" ${CFBundleName} \" buttons {\" OK \" , \" ${MSG_VISIT_JAVA_DOT_COM} \" , \" ${MSG_VISIT_ADOPTOPENJDK } \" } default button 1${DialogWithIcon} " \
853+ osascript -e " tell application \" System Events\" to display dialog \" ${MSG_ERROR_LAUNCHING} \n\n${MSG_NO_SUITABLE_JAVA_EXPANDED} \n${MSG_NO_SUITABLE_JAVA_CHECK} \" with title \" ${CFBundleName} \" buttons {\" OK \" , \" ${MSG_VISIT_JAVA_DOT_COM} \" , \" ${MSG_VISIT_ADOPTIUM } \" } default button 1${DialogWithIcon} " \
832854 -e " set response to button returned of the result" \
833855 -e " if response is \" ${MSG_VISIT_JAVA_DOT_COM} \" then open location \" https://www.java.com/download/\" " \
834- -e " if response is \" ${MSG_VISIT_ADOPTOPENJDK } \" then open location \" https://adoptopenjdk .net/releases.html\" "
856+ -e " if response is \" ${MSG_VISIT_ADOPTIUM } \" then open location \" https://adoptium .net/releases.html\" "
835857 # exit with error
836858 exit 3
837859
838860 else
839861 # log exit cause
840862 stub_logger " [EXIT 1] ${MSG_ERROR_LAUNCHING} "
841863 # display error message with AppleScript
842- osascript -e " tell application \" System Events\" to display dialog \" ${MSG_ERROR_LAUNCHING} \n\n${MSG_INSTALL_JAVA} \" with title \" ${CFBundleName} \" buttons {\" ${MSG_LATER} \" , \" ${MSG_VISIT_JAVA_DOT_COM} \" , \" ${MSG_VISIT_ADOPTOPENJDK } \" } default button 1${DialogWithIcon} " \
864+ osascript -e " tell application \" System Events\" to display dialog \" ${MSG_ERROR_LAUNCHING} \n\n${MSG_INSTALL_JAVA} \" with title \" ${CFBundleName} \" buttons {\" ${MSG_LATER} \" , \" ${MSG_VISIT_JAVA_DOT_COM} \" , \" ${MSG_VISIT_ADOPTIUM } \" } default button 1${DialogWithIcon} " \
843865 -e " set response to button returned of the result" \
844866 -e " if response is \" ${MSG_VISIT_JAVA_DOT_COM} \" then open location \" https://www.java.com/download/\" " \
845- -e " if response is \" ${MSG_VISIT_ADOPTOPENJDK } \" then open location \" https://adoptopenjdk .net/releases.html\" "
867+ -e " if response is \" ${MSG_VISIT_ADOPTIUM } \" then open location \" https://adoptium .net/releases.html\" "
846868 # exit with error
847869 exit 1
848870 fi
0 commit comments