长沙seo网站排名优化,临海知名营销型网站建设地址,vs2012网站开发课程设计,上海珍岛做网站怎么样Mac安装反编译工具步骤如下#xff1a;
打开官网https://java-decompiler.github.io/ 选择下载mac的安装包解压下载好的压缩包#xff0c;点击JD-GUI安装 有可能会遇到如下错误。请先检查是否安装JDK#xff0c;通过java -version命令查看是否是1.8版本的jdk如果jdk没问题
打开官网https://java-decompiler.github.io/ 选择下载mac的安装包解压下载好的压缩包点击JD-GUI安装 有可能会遇到如下错误。请先检查是否安装JDK通过java -version命令查看是否是1.8版本的jdk如果jdk没问题那么需要修改安装包文件。点击显示包内容-Contents-MacOs-universalJavaApplicationStub.sh;编辑文件把universalJavaApplicationStub.sh文件内容替换为如下内容 #!/bin/bash
##################################################################################
# #
# universalJavaApplicationStub #
# #
# A BASH based JavaApplicationStub for Java Apps on Mac OS X #
# that works with both Apples and Oracles plist format. #
# #
# Inspired by Ian Roberts stackoverflow answer #
# at http://stackoverflow.com/a/17546508/1128689 #
# #
# author Tobias Fischer #
# url https://github.com/tofi86/universalJavaApplicationStub #
# date 2020-03-19 #
# version 3.0.6 #
# #
##################################################################################
# #
# The MIT License (MIT) #
# #
# Copyright (c) 2014-2020 Tobias Fischer #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy #
# of this software and associated documentation files (the Software), to deal #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included in all #
# copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
# #
################################################################################### function stub_logger()
#
# A logger which logs to the macOS Console.app using the syslog command
#
# param1 the log message
# return void
################################################################################
function stub_logger() {syslog -s -k \Facility com.apple.console \Level Notice \Sender $(basename $0) \Message [$$][${CFBundleName:-$(basename $0)}] $1
}# set the directory abspath of the current
# shell script with symlinks being resolved
############################################PRG$0
while [ -h $PRG ]; dols$(ls -ld $PRG)link$(expr $ls : ^.*- \(.*\)$ 2/dev/null)if expr $link : ^/ 2 /dev/null /dev/null; thenPRG$linkelsePRG$(dirname $PRG)/$linkfi
done
PROGDIR$(dirname $PRG)
stub_logger [StubDir] $PROGDIR# set files and folders
############################################# the absolute path of the app package
cd $PROGDIR/../../ || exit 11
AppPackageFolder$(pwd)# the base path of the app package
cd .. || exit 12
AppPackageRoot$(pwd)# set Apples Java folder
AppleJavaFolder${AppPackageFolder}/Contents/Resources/Java# set Apples Resources folder
AppleResourcesFolder${AppPackageFolder}/Contents/Resources# set Oracles Java folder
OracleJavaFolder${AppPackageFolder}/Contents/Java# set Oracles Resources folder
OracleResourcesFolder${AppPackageFolder}/Contents/Resources# set path to Info.plist in bundle
InfoPlistFile${AppPackageFolder}/Contents/Info.plist# set the default JVM Version to a null string
JVMVersion
JVMMaxVersion# function plist_get()
#
# read a specific Plist key with PlistBuddy utility
#
# param1 the Plist key with leading colon :
# return the value as String or Array
################################################################################
plist_get(){/usr/libexec/PlistBuddy -c print $1 ${InfoPlistFile} 2 /dev/null
}# function plist_get_java()
#
# read a specific Plist key with PlistBuddy utility
# in the Java or JavaX dictionary (dict)
#
# param1 the Plist :Java(X):Key with leading colon :
# return the value as String or Array
################################################################################
plist_get_java(){plist_get ${JavaKey:-:Java}$1
}# read Info.plist and extract JVM options
############################################# read the program name from CFBundleName
CFBundleName$(plist_get :CFBundleName)# read the icon file name
CFBundleIconFile$(plist_get :CFBundleIconFile)# check Info.plist for Apple style Java keys - if key :Java is present, parse in apple mode
/usr/libexec/PlistBuddy -c print :Java ${InfoPlistFile} /dev/null 21
exitcode$?
JavaKey:Java# if no :Java key is present, check Info.plist for universalJavaApplication style JavaX keys - if key :JavaX is present, parse in apple mode
if [ $exitcode -ne 0 ]; then/usr/libexec/PlistBuddy -c print :JavaX ${InfoPlistFile} /dev/null 21exitcode$?JavaKey:JavaX
fi# read Info.plist file in Apple style if exit code returns 0 (true, :Java key is present)
if [ $exitcode -eq 0 ]; thenstub_logger [PlistStyle] Apple# set Java and Resources folderJavaFolder${AppleJavaFolder}ResourcesFolder${AppleResourcesFolder}APP_PACKAGE${AppPackageFolder}JAVAROOT${AppleJavaFolder}USER_HOME$HOME# read the Java WorkingDirectoryJVMWorkDir$(plist_get_java :WorkingDirectory | xargs)# set Working Directory based upon PList valueif [[ ! -z ${JVMWorkDir} ]]; thenWorkingDirectory${JVMWorkDir}else# AppPackageRoot is the standard WorkingDirectory when the script is startedWorkingDirectory${AppPackageRoot}fi# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOMEWorkingDirectory$(eval echo ${WorkingDirectory})# read the MainClass nameJVMMainClass$(plist_get_java :MainClass)# read the SplashFile nameJVMSplashFile$(plist_get_java :SplashFile)# read the JVM Properties as an array and retain spacesIFS$\t\nJVMOptions($(xargs -n1 $(plist_get_java :Properties | grep | sed s/^ */-D/g | sed -E s/ (.*)$/\1/g)))unset IFS# post processing of the array follows further below...# read the ClassPath in either Array or String styleJVMClassPath_RAW$(plist_get_java :ClassPath | xargs)if [[ $JVMClassPath_RAW *Array* ]] ; thenJVMClassPath.$(plist_get_java :ClassPath | grep | sed s/^ */:/g | tr -d \n | xargs)elseJVMClassPath${JVMClassPath_RAW}fi# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOMEJVMClassPath$(eval echo ${JVMClassPath})# read the JVM Options in either Array or String styleJVMDefaultOptions_RAW$(plist_get_java :VMOptions | xargs)if [[ $JVMDefaultOptions_RAW *Array* ]] ; thenJVMDefaultOptions$(plist_get_java :VMOptions | grep | sed s/^ */ /g | tr -d \n | xargs)elseJVMDefaultOptions${JVMDefaultOptions_RAW}fi# read StartOnMainThread and add as -XstartOnFirstThreadJVMStartOnMainThread$(plist_get_java :StartOnMainThread)if [ ${JVMStartOnMainThread} true ]; thenJVMDefaultOptions -XstartOnFirstThreadfi# read the JVM Arguments in either Array or String style (#76) and retain spacesIFS$\t\nMainArgs_RAW$(plist_get_java :Arguments | xargs)if [[ $MainArgs_RAW *Array* ]] ; thenMainArgs($(xargs -n1 $(plist_get_java :Arguments | tr -d \n | sed -E s/Array \{ *(.*) *\}/\1/g | sed s/ */ /g)))elseMainArgs($(xargs -n1 $(plist_get_java :Arguments)))fiunset IFS# post processing of the array follows further below...# read the Java version we want to findJVMVersion$(plist_get_java :JVMVersion | xargs)# post processing of the version string follows below...# read Info.plist file in Oracle style
elsestub_logger [PlistStyle] Oracle# set Working Directory and Java and Resources folderJavaFolder${OracleJavaFolder}ResourcesFolder${OracleResourcesFolder}WorkingDirectory${OracleJavaFolder}APP_ROOT${AppPackageFolder}# read the MainClass nameJVMMainClass$(plist_get :JVMMainClassName)# read the SplashFile nameJVMSplashFile$(plist_get :JVMSplashFile)# read the JVM Options as an array and retain spacesIFS$\t\nJVMOptions($(plist_get :JVMOptions | grep | sed s/^ *//g))unset IFS# post processing of the array follows further below...# read the ClassPath in either Array or String styleJVMClassPath_RAW$(plist_get :JVMClassPath)if [[ $JVMClassPath_RAW *Array* ]] ; thenJVMClassPath.$(plist_get :JVMClassPath | grep | sed s/^ */:/g | tr -d \n | xargs)# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOMEJVMClassPath$(eval echo ${JVMClassPath})elif [[ ! -z ${JVMClassPath_RAW} ]] ; thenJVMClassPath${JVMClassPath_RAW}# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOMEJVMClassPath$(eval echo ${JVMClassPath})else#default: fallback to OracleJavaFolderJVMClassPath${JavaFolder}/*# Do NOT expand the default AppName.app/Contents/Java/* classpath (#42)fi# read the JVM Default OptionsJVMDefaultOptions$(plist_get :JVMDefaultOptions | grep -o \-.* | tr -d \n | xargs)# read the Main Arguments from JVMArguments key as an array and retain spaces (see #46 for naming details)IFS$\t\nMainArgs($(xargs -n1 $(plist_get :JVMArguments | tr -d \n | sed -E s/Array \{ *(.*) *\}/\1/g | sed s/ */ /g)))unset IFS# post processing of the array follows further below...# read the Java version we want to findJVMVersion$(plist_get :JVMVersion | xargs)# post processing of the version string follows below...
fi# (#75) check for undefined icons or icon names without .icns extension and prepare
# an osascript statement for those cases when the icon can be shown in the dialog
DialogWithIcon
if [ ! -z ${CFBundleIconFile} ]; thenif [[ ${CFBundleIconFile} *.icns ]] [[ -f ${ResourcesFolder}/${CFBundleIconFile} ]] ; thenDialogWithIcon with icon path to resource \${CFBundleIconFile}\ in bundle (path to me)elif [[ ${CFBundleIconFile} ! *.icns ]] [[ -f ${ResourcesFolder}/${CFBundleIconFile}.icns ]] ; thenCFBundleIconFile.icnsDialogWithIcon with icon path to resource \${CFBundleIconFile}\ in bundle (path to me)fi
fi# JVMVersion: post processing and optional splitting
if [[ ${JVMVersion} *;* ]]; thenminMaxArray(${JVMVersion//;/ })JVMVersion${minMaxArray[0]//}JVMMaxVersion${minMaxArray[1]//}
fi
stub_logger [JavaRequirement] JVM minimum version: ${JVMVersion}
stub_logger [JavaRequirement] JVM maximum version: ${JVMMaxVersion}# MainArgs: replace occurences of $APP_ROOT with its content
MainArgsArr()
for i in ${MainArgs[]}
doMainArgsArr($(eval echo $i))
done# JVMOptions: replace occurences of $APP_ROOT with its content
JVMOptionsArr()
for i in ${JVMOptions[]}
doJVMOptionsArr($(eval echo $i))
done# internationalized messages
############################################LANG$(defaults read -g AppleLocale)
stub_logger [Language] $LANG# French localization
if [[ $LANG fr* ]] ; thenMSG_ERROR_LAUNCHINGERREUR au lancement de ${CFBundleName}.MSG_MISSING_MAINCLASSMainClass nest pas spécifié.\nLapplication Java ne peut pas être lancée.MSG_JVMVERSION_REQ_INVALIDLa syntaxe de la version de Java demandée est invalide: %s\nVeuillez contacter le développeur de lapplication.MSG_NO_SUITABLE_JAVALa version de Java installée sur votre système ne convient pas.\nCe programme nécessite Java %sMSG_JAVA_VERSION_OR_LATERou ultérieurMSG_JAVA_VERSION_LATEST(dernière mise à jour)MSG_JAVA_VERSION_MAXà %sMSG_NO_SUITABLE_JAVA_CHECKMerci de bien vouloir installer la version de Java requise.MSG_INSTALL_JAVAJava doit être installé sur votre système.\nRendez-vous sur java.com et suivez les instructions dinstallation...MSG_LATERPlus tardMSG_VISIT_JAVA_DOT_COMJava by OracleMSG_VISIT_ADOPTOPENJDKJava by AdoptOpenJDK# German localization
elif [[ $LANG de* ]] ; thenMSG_ERROR_LAUNCHINGFEHLER beim Starten von ${CFBundleName}.MSG_MISSING_MAINCLASSDie MainClass ist nicht spezifiziert!\nDie Java-Anwendung kann nicht gestartet werden!MSG_JVMVERSION_REQ_INVALIDDie Syntax der angeforderten Java-Version ist ungültig: %s\nBitte kontaktieren Sie den Entwickler der App.MSG_NO_SUITABLE_JAVAEs wurde keine passende Java-Version auf Ihrem System gefunden!\nDieses Programm benötigt Java %sMSG_JAVA_VERSION_OR_LATERoder neuerMSG_JAVA_VERSION_LATEST(neuste Unterversion)MSG_JAVA_VERSION_MAXbis %sMSG_NO_SUITABLE_JAVA_CHECKStellen Sie sicher, dass die angeforderte Java-Version installiert ist.MSG_INSTALL_JAVAAuf Ihrem System muss die Java-Software installiert sein.\nBesuchen Sie java.com für weitere Installationshinweise.MSG_LATERSpäterMSG_VISIT_JAVA_DOT_COMJava von OracleMSG_VISIT_ADOPTOPENJDKJava von AdoptOpenJDK# Simplifyed Chinese localization
elif [[ $LANG zh* ]] ; thenMSG_ERROR_LAUNCHING无法启动 ${CFBundleName}.MSG_MISSING_MAINCLASS没有指定 MainClass\nJava程序无法启动!MSG_JVMVERSION_REQ_INVALIDJava版本参数语法错误: %s\n请联系该应用的开发者。MSG_NO_SUITABLE_JAVA没有在系统中找到合适的Java版本\n必须安装Java %s才能够使用该程序MSG_JAVA_VERSION_OR_LATER及以上版本MSG_JAVA_VERSION_LATEST最新版本MSG_JAVA_VERSION_MAX最高为 %sMSG_NO_SUITABLE_JAVA_CHECK请确保系统中安装了所需的Java版本MSG_INSTALL_JAVA你需要在Mac中安装Java运行环境\n访问 java.com 了解如何安装。MSG_LATER稍后MSG_VISIT_JAVA_DOT_COMJava by OracleMSG_VISIT_ADOPTOPENJDKJava by AdoptOpenJDK# English default localization
elseMSG_ERROR_LAUNCHINGERROR launching ${CFBundleName}.MSG_MISSING_MAINCLASSMainClass isnt specified!\nJava application cannot be started!MSG_JVMVERSION_REQ_INVALIDThe syntax of the required Java version is invalid: %s\nPlease contact the App developer.MSG_NO_SUITABLE_JAVANo suitable Java version found on your system!\nThis program requires Java %sMSG_JAVA_VERSION_OR_LATERor laterMSG_JAVA_VERSION_LATEST(latest update)MSG_JAVA_VERSION_MAXup to %sMSG_NO_SUITABLE_JAVA_CHECKMake sure you install the required Java version.MSG_INSTALL_JAVAYou need to have JAVA installed on your Mac!\nVisit java.com for installation instructions...MSG_LATERLaterMSG_VISIT_JAVA_DOT_COMJava by OracleMSG_VISIT_ADOPTOPENJDKJava by AdoptOpenJDK
fi# function get_java_version_from_cmd()
#
# returns Java version string from java -version command
# works for both old (1.8) and new (9) version schema
#
# param1 path to a java JVM executable
# return the Java version number as displayed in java -version command
################################################################################
function get_java_version_from_cmd() {# second sed command strips and -ea from the version stringecho $($1 -version 21 | awk /version/{print $3} | sed -E s///g;s/-ea//g)
}# function extract_java_major_version()
#
# extract Java major version from a version string
#
# param1 a Java version number (1.8.0_45) or requirement string (1.8)
# return the major version (e.g. 7, 8 or 9, etc.)
################################################################################
function extract_java_major_version() {echo $(echo $1 | sed -E s/^1\.//;s/^([0-9])(-ea|(\.[0-9_.]{1,7})?)(-b[0-9]-[0-9])?[*]?$/\1/)
}# function get_comparable_java_version()
#
# return comparable version for a Java version number or requirement string
#
# param1 a Java version number (1.8.0_45) or requirement string (1.8)
# return an 8 digit numeral (1.8.0_45-08000045; 9.1.13-09001013)
################################################################################
function get_comparable_java_version() {# cleaning: 1) remove leading 1.; 2) remove build string (e.g. -b14-468); 3) remove a-Z and -* (e.g. -ea); 4) replace _ with .local cleaned$(echo $1 | sed -E s/^1\.//g;s/-b[0-9]-[0-9]$//g;s/[a-zA-Z*\-]//g;s/_/./g)# splitting at . into an arraylocal arr( ${cleaned//./ } )# echo a string with left padded version numbersecho $(printf %02s ${arr[0]})$(printf %03s ${arr[1]})$(printf %03s ${arr[2]})
}# function is_valid_requirement_pattern()
#
# check whether the Java requirement is a valid requirement pattern
#
# supported requirements are for example:
# - 1.6 requires Java 6 (any update) [1.6, 1.6.0_45, 1.6.0_88]
# - 1.6* requires Java 6 (any update) [1.6, 1.6.0_45, 1.6.0_88]
# - 1.6 requires Java 6 or higher [1.6, 1.6.0_45, 1.8, 9, etc.]
# - 1.6.0 requires Java 6 (any update) [1.6, 1.6.0_45, 1.6.0_88]
# - 1.6.0_45 requires Java 6u45 [1.6.0_45]
# - 1.6.0_45 requires Java 6u45 or higher [1.6.0_45, 1.6.0_88, 1.8, etc.]
# - 9 requires Java 9 (any update) [9.0.*, 9.1, 9.3, etc.]
# - 9* requires Java 9 (any update) [9.0.*, 9.1, 9.3, etc.]
# - 9 requires Java 9 or higher [9.0, 9.1, 10, etc.]
# - 9.1 requires Java 9.1 (any update) [9.1.*, 9.1.2, 9.1.13, etc.]
# - 9.1* requires Java 9.1 (any update) [9.1.*, 9.1.2, 9.1.13, etc.]
# - 9.1 requires Java 9.1 or higher [9.1, 9.2, 10, etc.]
# - 9.1.3 requires Java 9.1.3 [9.1.3]
# - 9.1.3* requires Java 9.1.3 (any update) [9.1.3]
# - 9.1.3 requires Java 9.1.3 or higher [9.1.3, 9.1.4, 9.2.*, 10, etc.]
# - 10-ea requires Java 10 (early access release)
#
# unsupported requirement patterns are for example:
# - 1.2, 1.3, 1.9 Java 2, 3 are not supported
# - 1.9 Java 9 introduced a new versioning scheme
# - 6u45 known versioning syntax, but unsupported
# - 9-ea*, 9-ea early access releases paired with */
# - 9., 9.*, 9. version ending with a .
# - 9.1., 9.1.*, 9.1. version ending with a .
# - 9.3.5.6 4 part version number is unsupported
#
# param1 a Java requirement string (1.8)
# return boolean exit code: 0 (is valid), 1 (is not valid)
################################################################################
function is_valid_requirement_pattern() {local java_req$1java8pattern1\.[4-8](\.[0-9])?(\.0_[0-9])?[*]?java9pattern(9|1[0-9])(-ea|[*]|(\.[0-9]){1,2}[*]?)?# test matches either old Java versioning scheme (up to 1.8) or new scheme (starting with 9)if [[ ${java_req} ~ ^(${java8pattern}|${java9pattern})$ ]]; thenreturn 0elsereturn 1fi
}# determine which JVM to use
############################################# default Apple JRE plugin path ( 1.6)
apple_jre_plugin/Library/Java/Home/bin/java
apple_jre_version$(get_java_version_from_cmd ${apple_jre_plugin})
# default Oracle JRE plugin path ( 1.7)
oracle_jre_plugin/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
oracle_jre_version$(get_java_version_from_cmd ${oracle_jre_plugin})# first check system variable $JAVA_HOME - has precedence over any other System JVM
stub_logger [JavaSearch] Checking for $JAVA_HOME ...
if [ -n $JAVA_HOME ] ; thenstub_logger [JavaSearch] ... found JAVA_HOME with value $JAVA_HOME# PR 26: Allow specifying $JAVA_HOME relative to $AppPackageFolder# which allows for bundling a custom version of Java inside your app!if [[ $JAVA_HOME /* ]] ; then# if $JAVA_HOME starts with a Slash its an absolute pathJAVACMD$JAVA_HOME/bin/javaelse# otherwise its a relative path to $AppPackageFolderJAVACMD$AppPackageFolder/$JAVA_HOME/bin/javafiJAVACMD_version$(get_comparable_java_version $(get_java_version_from_cmd ${JAVACMD}))
elsestub_logger [JavaSearch] ... didnt found JAVA_HOME
fi# check for any other or a specific Java version
# also if $JAVA_HOME exists but isnt executable
if [ -z ${JAVACMD} ] || [ ! -x ${JAVACMD} ] ; thenstub_logger [JavaSearch] Checking for JavaVirtualMachines on the system ...# reset variablesJAVACMDJAVACMD_version# first check whether JVMVersion string is a valid requirement stringif [ ! -z ${JVMVersion} ] ! is_valid_requirement_pattern ${JVMVersion} ; thenMSG_JVMVERSION_REQ_INVALID_EXPANDED$(printf ${MSG_JVMVERSION_REQ_INVALID} ${JVMVersion})# log exit causestub_logger [EXIT 4] ${MSG_JVMVERSION_REQ_INVALID_EXPANDED}# display error message with AppleScriptosascript -e tell application \System Events\ to display dialog \${MSG_ERROR_LAUNCHING}\n\n${MSG_JVMVERSION_REQ_INVALID_EXPANDED}\ with title \${CFBundleName}\ buttons {\ OK \} default button 1${DialogWithIcon}# exit with errorexit 4fi# then check whether JVMMaxVersion string is a valid requirement stringif [ ! -z ${JVMMaxVersion} ] ! is_valid_requirement_pattern ${JVMMaxVersion} ; thenMSG_JVMVERSION_REQ_INVALID_EXPANDED$(printf ${MSG_JVMVERSION_REQ_INVALID} ${JVMMaxVersion})# log exit causestub_logger [EXIT 5] ${MSG_JVMVERSION_REQ_INVALID_EXPANDED}# display error message with AppleScriptosascript -e tell application \System Events\ to display dialog \${MSG_ERROR_LAUNCHING}\n\n${MSG_JVMVERSION_REQ_INVALID_EXPANDED}\ with title \${CFBundleName}\ buttons {\ OK \} default button 1${DialogWithIcon}# exit with errorexit 5fi# find installed JavaVirtualMachines (JDK JRE)allJVMs()# read JDKs from /usr/libexec/java_home -V commandwhile read -r line; doversion$(echo $line | awk -F $, {print $1;})path$(echo $line | awk -F $ {print $2;})path/bin/javaallJVMs($version:$path)done (/usr/libexec/java_home -V 21 | grep ^[[:space:]])# unset while loop variablesunset version path# add Apple JRE if availableif [ -x ${apple_jre_plugin} ] ; thenallJVMs($apple_jre_version:$apple_jre_plugin)fi# add Oracle JRE if availableif [ -x ${oracle_jre_plugin} ] ; thenallJVMs($oracle_jre_version:$oracle_jre_plugin)fi# debug outputfor i in ${allJVMs[]}dostub_logger [JavaSearch] ... found JVM: $idone# determine JVMs matching the min/max version requirementminC$(get_comparable_java_version ${JVMVersion})maxC$(get_comparable_java_version ${JVMMaxVersion})matchingJVMs()for i in ${allJVMs[]}do# split JVM string at : delimiter to retain spaces in $path substringIFS: arr($i) ; unset IFS# [0] JVM version numberver${arr[0]}# comparable JVM version numbercomp$(get_comparable_java_version $ver)# [1] JVM pathpath${arr[1]}# construct string item for adding to the matchingJVMs arrayitem$comp:$ver:$path# pre-requisite: current version number needs to be greater than min version numberif [ $comp -ge $minC ] ; then# perform max version checks if max version requirement is presentif [ ! -z ${JVMMaxVersion} ] ; then# max version requirement ends with * modifierif [[ ${JVMMaxVersion} *\* ]] ; then# use the * modifier from the max version string as wildcard for a starts with comparison# and check whether the current version number starts with the max version wildcard stringif [[ ${ver} ${JVMMaxVersion} ]]; thenmatchingJVMs($item)# or whether the current comparable version is lower than the comparable max versionelif [ $comp -le $maxC ] ; thenmatchingJVMs($item)fi# max version requirement ends with modifier - always add this version if its greater than $min# because a max requirement with modifier doesnt make senseelif [[ ${JVMMaxVersion} * ]] ; thenmatchingJVMs($item)# matches 6 zeros at the end of the max version string (e.g. for 1.8, 9)# - then the max version string should be treated like with a * modifier at the end#elif [[ ${maxC} ~ ^[0-9]{2}0{6}$ ]] [ $comp -le $(( ${maxC#0} 999 )) ] ; then# matchingJVMs($item)# matches 3 zeros at the end of the max version string (e.g. for 9.1, 10.3)# - then the max version string should be treated like with a * modifier at the end#elif [[ ${maxC} ~ ^[0-9]{5}0{3}$ ]] [ $comp -le ${maxC} ] ; then# matchingJVMs($item)# matches standard requirements without modifierelif [ $comp -le $maxC ]; thenmatchingJVMs($item)fi# no max version requirement:# min version requirement ends with modifier# - always add the current version because its greater than $minelif [[ ${JVMVersion} * ]] ; thenmatchingJVMs($item)# min version requirement ends with * modifier# - use the * modifier from the min version string as wildcard for a starts with comparison# and check whether the current version number starts with the min version wildcard stringelif [[ ${JVMVersion} *\* ]] ; thenif [[ ${ver} ${JVMVersion} ]] ; thenmatchingJVMs($item)fi# compare the min version against the current version with an additional * wildcard for a starts with comparison# - e.g. add 1.8.0_44 when the requirement is 1.8elif [[ ${ver} ${JVMVersion}* ]] ; thenmatchingJVMs($item)fifidone# unset for loop variablesunset arr ver comp path item# debug outputfor i in ${matchingJVMs[]}dostub_logger [JavaSearch] ... ... matches all requirements: $idone# sort the matching JavaVirtualMachines by version number# https://stackoverflow.com/a/11789688/1128689IFS$\n matchingJVMs($(sort -nr ${matchingJVMs[*]}))unset IFS# get the highest matching JVMfor ((i 0; i ${#matchingJVMs[]}; i));do# split JVM string at : delimiter to retain spaces in $path substringIFS: arr(${matchingJVMs[$i]}) ; unset IFS# [0] comparable JVM version numbercomp${arr[0]}# [1] JVM version numberver${arr[1]}# [2] JVM pathpath${arr[2]}# use current value as JAVACMD if its executableif [ -x $path ] ; thenJAVACMD$pathJAVACMD_version$compbreakfidone# unset for loop variablesunset arr comp ver path
fi# log the Java Command and the extracted version number
stub_logger [JavaCommand] $JAVACMD
stub_logger [JavaVersion] $(get_java_version_from_cmd ${JAVACMD})${JAVACMD_version: / $JAVACMD_version}if [ -z ${JAVACMD} ] || [ ! -x ${JAVACMD} ] ; then# different error messages when a specific JVM was requiredif [ ! -z ${JVMVersion} ] ; then# display human readable java version (#28)java_version_hr$(echo ${JVMVersion} | sed -E s/^1\.([0-9*])$/ \1/g | sed s// ${MSG_JAVA_VERSION_OR_LATER}/;s/*/ ${MSG_JAVA_VERSION_LATEST}/)MSG_NO_SUITABLE_JAVA_EXPANDED$(printf ${MSG_NO_SUITABLE_JAVA} ${java_version_hr}).if [ ! -z ${JVMMaxVersion} ] ; thenjava_version_hr$(extract_java_major_version ${JVMVersion})java_version_max_hr$(echo ${JVMMaxVersion} | sed -E s/^1\.([0-9*])$/ \1/g | sed s///;s/*/ ${MSG_JAVA_VERSION_LATEST}/)MSG_NO_SUITABLE_JAVA_EXPANDED$(printf ${MSG_NO_SUITABLE_JAVA} ${java_version_hr}) $(printf ${MSG_JAVA_VERSION_MAX} ${java_version_max_hr})fi# log exit causestub_logger [EXIT 3] ${MSG_NO_SUITABLE_JAVA_EXPANDED}# display error message with AppleScriptosascript -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} \-e set response to button returned of the result \-e if response is \${MSG_VISIT_JAVA_DOT_COM}\ then open location \https://www.java.com/download/\ \-e if response is \${MSG_VISIT_ADOPTOPENJDK}\ then open location \https://adoptopenjdk.net/releases.html\# exit with errorexit 3else# log exit causestub_logger [EXIT 1] ${MSG_ERROR_LAUNCHING}# display error message with AppleScriptosascript -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} \-e set response to button returned of the result \-e if response is \${MSG_VISIT_JAVA_DOT_COM}\ then open location \https://www.java.com/download/\ \-e if response is \${MSG_VISIT_ADOPTOPENJDK}\ then open location \https://adoptopenjdk.net/releases.html\# exit with errorexit 1fi
fi# MainClass check
############################################if [ -z ${JVMMainClass} ]; then# log exit causestub_logger [EXIT 2] ${MSG_MISSING_MAINCLASS}# display error message with AppleScriptosascript -e tell application \System Events\ to display dialog \${MSG_ERROR_LAUNCHING}\n\n${MSG_MISSING_MAINCLASS}\ with title \${CFBundleName}\ buttons {\ OK \} default button 1${DialogWithIcon}# exit with errorexit 2
fi# execute $JAVACMD and do some preparation
############################################# enable dragdrop to the dock icon
export CFProcessPath$0# remove Apples ProcessSerialNumber from passthru arguments (#39)
if [[ $* -psn* ]] ; thenArgsPassthru()
elseArgsPassthru($)
fi# change to Working Directory based upon Apple/Oracle Plist info
cd ${WorkingDirectory} || exit 13
stub_logger [WorkingDirectory] ${WorkingDirectory}# execute Java and set
# - classpath
# - splash image
# - dock icon
# - app name
# - JVM options / properties (-D)
# - JVM default options (-X)
# - main class
# - main class arguments
# - passthrough arguments from Terminal or DragnDrop to Finder icon
stub_logger [Exec] \$JAVACMD\ -cp \${JVMClassPath}\ -splash:\${ResourcesFolder}/${JVMSplashFile}\ -Xdock:icon\${ResourcesFolder}/${CFBundleIconFile}\ -Xdock:name\${CFBundleName}\ ${JVMOptionsArr:$(printf %s ${JVMOptionsArr[]}) }${JVMDefaultOptions:$JVMDefaultOptions }${JVMMainClass}${MainArgsArr: $(printf %s ${MainArgsArr[]})}${ArgsPassthru: $(printf %s ${ArgsPassthru[]})}
exec ${JAVACMD} \-cp ${JVMClassPath} \-splash:${ResourcesFolder}/${JVMSplashFile} \-Xdock:icon${ResourcesFolder}/${CFBundleIconFile} \-Xdock:name${CFBundleName} \${JVMOptionsArr:${JVMOptionsArr[]} }\${JVMDefaultOptions:$JVMDefaultOptions }\${JVMMainClass}\${MainArgsArr: ${MainArgsArr[]}}\${ArgsPassthru: ${ArgsPassthru[]}}保存关闭再次点击JD-GUI便可以顺利打开。最后我们可以把这个应用程序拖到启动台这样以后需要的时候就可以打开了。 文章转载自: http://www.morning.xdwcg.cn.gov.cn.xdwcg.cn http://www.morning.yrjkz.cn.gov.cn.yrjkz.cn http://www.morning.xqxrm.cn.gov.cn.xqxrm.cn http://www.morning.fhsgw.cn.gov.cn.fhsgw.cn http://www.morning.ttdxn.cn.gov.cn.ttdxn.cn http://www.morning.rxydr.cn.gov.cn.rxydr.cn http://www.morning.wtdhm.cn.gov.cn.wtdhm.cn http://www.morning.sqhtg.cn.gov.cn.sqhtg.cn http://www.morning.grpfj.cn.gov.cn.grpfj.cn http://www.morning.crhd.cn.gov.cn.crhd.cn http://www.morning.sbczr.cn.gov.cn.sbczr.cn http://www.morning.ylph.cn.gov.cn.ylph.cn http://www.morning.tdldh.cn.gov.cn.tdldh.cn http://www.morning.qwfl.cn.gov.cn.qwfl.cn http://www.morning.rksnk.cn.gov.cn.rksnk.cn http://www.morning.xnpj.cn.gov.cn.xnpj.cn http://www.morning.fqpgf.cn.gov.cn.fqpgf.cn http://www.morning.ckwrn.cn.gov.cn.ckwrn.cn http://www.morning.mywmb.cn.gov.cn.mywmb.cn http://www.morning.mqwdh.cn.gov.cn.mqwdh.cn http://www.morning.qtfss.cn.gov.cn.qtfss.cn http://www.morning.yrgb.cn.gov.cn.yrgb.cn http://www.morning.zlrsy.cn.gov.cn.zlrsy.cn http://www.morning.srbsr.cn.gov.cn.srbsr.cn http://www.morning.nyqnk.cn.gov.cn.nyqnk.cn http://www.morning.jwncx.cn.gov.cn.jwncx.cn http://www.morning.yrqb.cn.gov.cn.yrqb.cn http://www.morning.nwpnj.cn.gov.cn.nwpnj.cn http://www.morning.wjtwn.cn.gov.cn.wjtwn.cn http://www.morning.jfymz.cn.gov.cn.jfymz.cn http://www.morning.ghfrb.cn.gov.cn.ghfrb.cn http://www.morning.rbkdg.cn.gov.cn.rbkdg.cn http://www.morning.brjq.cn.gov.cn.brjq.cn http://www.morning.yskhj.cn.gov.cn.yskhj.cn http://www.morning.paxkhqq.cn.gov.cn.paxkhqq.cn http://www.morning.dbqcw.com.gov.cn.dbqcw.com http://www.morning.nydtt.cn.gov.cn.nydtt.cn http://www.morning.qnhpq.cn.gov.cn.qnhpq.cn http://www.morning.brlcj.cn.gov.cn.brlcj.cn http://www.morning.mqmmc.cn.gov.cn.mqmmc.cn http://www.morning.lrybz.cn.gov.cn.lrybz.cn http://www.morning.plqqn.cn.gov.cn.plqqn.cn http://www.morning.wskn.cn.gov.cn.wskn.cn http://www.morning.ffwrq.cn.gov.cn.ffwrq.cn http://www.morning.qkpzq.cn.gov.cn.qkpzq.cn http://www.morning.c7617.cn.gov.cn.c7617.cn http://www.morning.rfxg.cn.gov.cn.rfxg.cn http://www.morning.srgnd.cn.gov.cn.srgnd.cn http://www.morning.lcdtb.cn.gov.cn.lcdtb.cn http://www.morning.nmfxs.cn.gov.cn.nmfxs.cn http://www.morning.fmqw.cn.gov.cn.fmqw.cn http://www.morning.rsnn.cn.gov.cn.rsnn.cn http://www.morning.jqbmj.cn.gov.cn.jqbmj.cn http://www.morning.rmxgk.cn.gov.cn.rmxgk.cn http://www.morning.mxhcf.cn.gov.cn.mxhcf.cn http://www.morning.fllfc.cn.gov.cn.fllfc.cn http://www.morning.txqgd.cn.gov.cn.txqgd.cn http://www.morning.rdsst.cn.gov.cn.rdsst.cn http://www.morning.jtybl.cn.gov.cn.jtybl.cn http://www.morning.ldnrf.cn.gov.cn.ldnrf.cn http://www.morning.kpbgp.cn.gov.cn.kpbgp.cn http://www.morning.cnyqj.cn.gov.cn.cnyqj.cn http://www.morning.thxfn.cn.gov.cn.thxfn.cn http://www.morning.lrskd.cn.gov.cn.lrskd.cn http://www.morning.bkfdf.cn.gov.cn.bkfdf.cn http://www.morning.mxmtt.cn.gov.cn.mxmtt.cn http://www.morning.bloao.com.gov.cn.bloao.com http://www.morning.wnkqt.cn.gov.cn.wnkqt.cn http://www.morning.rgwrl.cn.gov.cn.rgwrl.cn http://www.morning.rxkq.cn.gov.cn.rxkq.cn http://www.morning.xplng.cn.gov.cn.xplng.cn http://www.morning.pzss.cn.gov.cn.pzss.cn http://www.morning.hsrch.cn.gov.cn.hsrch.cn http://www.morning.rlhjg.cn.gov.cn.rlhjg.cn http://www.morning.ktcfl.cn.gov.cn.ktcfl.cn http://www.morning.bxfy.cn.gov.cn.bxfy.cn http://www.morning.c7498.cn.gov.cn.c7498.cn http://www.morning.jwncx.cn.gov.cn.jwncx.cn http://www.morning.tqsgt.cn.gov.cn.tqsgt.cn http://www.morning.qnklx.cn.gov.cn.qnklx.cn