iis服务器助手广告广告
返回顶部
首页 > 资讯 > 移动开发 >Mac 安装Java反编译工具JD-GUI
  • 670
分享到

Mac 安装Java反编译工具JD-GUI

macosjavabashjd-gui 2023-08-31 14:08:12 670人浏览 独家记忆
摘要

一、下载JD-GUI软件 首先到GitHub下载JD-GUI软件: github java-decompiler/jd-gui Public 选择jd-gui-osx-1.6.6.tar. 解压打开软

一、下载JD-GUI软件

首先到GitHub下载JD-GUI软件:
github java-decompiler/jd-gui Public

选择jd-gui-osx-1.6.6.tar.

解压打开软件,但是提示错误:

在这里插入图片描述

确保本机已安装jdk.

如果确定已经安装了JDK海报这个这个错误,选中JD-GUI,右键显示包内容,找到这个文件:
在这里插入图片描述
5.文本编辑器编辑这个universalJavaApplicationStub.sh

使用以下内容替换:

#!/bin/bash###################################################################################                        ## universalJavaApplicationStub                       ##                        ## A BASH based JavaApplicationStub for Java Apps on Mac OS X                     ## that works with both Apple's and oracle's 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=$0while [ -h "$PRG" ]; dols=$(ls -ld "$PRG")link=$(expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null)if expr "$link" : '^/' 2> /dev/null >/dev/null; thenPRG="$link"elsePRG="$(dirname "$PRG")/$link"fidonePROGDIR=$(dirname "$PRG")stub_logger "[StubDir] $PROGDIR"   # set files and folders############################################ # the absolute path of the app packagecd "$PROGDIR"/../../ || exit 11AppPackageFolder=$(pwd) # the base path of the app packagecd .. || exit 12AppPackageRoot=$(pwd) # set Apple's Java folderAppleJavaFolder="${AppPackageFolder}"/Contents/Resources/Java # set Apple's Resources folderAppleResourcesFolder="${AppPackageFolder}"/Contents/Resources # set Oracle's Java folderOracleJavaFolder="${AppPackageFolder}"/Contents/Java # set Oracle's Resources folderOracleResourcesFolder="${AppPackageFolder}"/Contents/Resources # set path to Info.plist in bundleInfoPlistFile="${AppPackageFolder}"/Contents/Info.plist # set the default JVM Version to a null stringJVMVersion=""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 ()## @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 CFBundleNameCFBundleName=$(plist_get ':CFBundleName') # read the icon file nameCFBundleIconFile=$(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 2>&1exitcode=$?JavaKey=":Java" # if no :Java key is present, check Info.plist for universalJavaApplication style JavaX keys -> if key :JavaX is present, parse in apple modeif [ $exitcode -ne 0 ]; then/usr/libexec/PlistBuddy -c "print :JavaX" "${InfoPlistFile}" > /dev/null 2>&1exitcode=$?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\n'JVMOptions=($(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+=" -XstartOnFirstThread"fi # read the JVM Arguments in either Array or String style (#76) and retain spacesIFS=$'\t\n'MainArgs_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 styleelsestub_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\n'JVMOptions=($(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} /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 dialogDialogWithIcon=""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+=".icns"DialogWithIcon=" with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)"fifi  # JVMVersion: post processing and optional splittingif [[ ${JVMVersion} == *";"* ]]; thenminMaxArray=(${JVMVersion//;/ })JVMVersion=${minMaxArray[0]//+}JVMMaxVersion=${minMaxArray[1]//+}fistub_logger "[JavaRequirement] JVM minimum version: ${JVMVersion}"stub_logger "[JavaRequirement] JVM maximum version: ${JVMMaxVersion}" # MainArgs: replace occurences of $APP_ROOT with its contentMainArgsArr=()for i in "${MainArgs[@]}"doMainArgsArr+=("$(eval echo "$i")")done # JVMOptions: replace occurences of $APP_ROOT with its contentJVMOptionsArr=()for i in "${JVMOptions[@]}"doJVMOptionsArr+=("$(eval echo "$i")")done  # internationalized messages############################################ LANG=$(defaults read -g AppleLocale)stub_logger "[Language] $LANG" # French localizationif [[ $LANG == fr* ]] ; thenMSG_ERROR_LAUNCHING="ERREUR au lancement de '${CFBundleName}'."MSG_MISSING_MAINCLASS="'MainClass' n'est pas spécifié.\nL'application Java ne peut pas être lancée."MSG_JVMVERSION_REQ_INVALID="La syntaxe de la version de Java demandée est invalide: %s\nVeuillez contacter le développeur de l'application."MSG_NO_SUITABLE_JAVA="La version de Java installée sur votre système ne convient pas.\nCe programme nécessite Java %s"MSG_JAVA_VERSION_OR_LATER="ou ultérieur"MSG_JAVA_VERSION_LATEST="(dernière mise à jour)"MSG_JAVA_VERSION_MAX="à %s"MSG_NO_SUITABLE_JAVA_CHECK="Merci de bien vouloir installer la version de Java requise."MSG_INSTALL_JAVA="Java doit être installé sur votre système.\nRendez-vous sur java.com et suivez les instructions d'installation..."MSG_LATER="Plus tard"MSG_VISIT_JAVA_DOT_COM="Java by Oracle"MSG_VISIT_ADOPTOPENJDK="Java by AdoptOpenJDK" # German localizationelif [[ $LANG == de* ]] ; thenMSG_ERROR_LAUNCHING="FEHLER beim Starten von '${CFBundleName}'."MSG_MISSING_MAINCLASS="Die 'MainClass' ist nicht spezifiziert!\nDie Java-Anwendung kann nicht gestartet werden!"MSG_JVMVERSION_REQ_INVALID="Die Syntax der angeforderten Java-Version ist ungültig: %s\nBitte kontaktieren Sie den Entwickler der App."MSG_NO_SUITABLE_JAVA="Es wurde keine passende Java-Version auf Ihrem System gefunden!\nDieses Programm benötigt Java %s"MSG_JAVA_VERSION_OR_LATER="oder neuer"MSG_JAVA_VERSION_LATEST="(neuste Unterversion)"MSG_JAVA_VERSION_MAX="bis %s"MSG_NO_SUITABLE_JAVA_CHECK="Stellen Sie sicher, dass die angeforderte Java-Version installiert ist."MSG_INSTALL_JAVA="Auf Ihrem System muss die 'Java'-Software installiert sein.\nBesuchen Sie java.com für weitere Installationshinweise."MSG_LATER="Später"MSG_VISIT_JAVA_DOT_COM="Java von Oracle"MSG_VISIT_ADOPTOPENJDK="Java von AdoptOpenJDK" # Simplifyed Chinese localizationelif [[ $LANG == zh* ]] ; thenMSG_ERROR_LAUNCHING="无法启动 '${CFBundleName}'."MSG_MISSING_MAINCLASS="没有指定 'MainClass'!\nJava程序无法启动!"MSG_JVMVERSION_REQ_INVALID="Java版本参数语法错误: %s\n请联系该应用的开发者。"MSG_NO_SUITABLE_JAVA="没有在系统中找到合适的Java版本!\n必须安装Java %s才能够使用该程序!"MSG_JAVA_VERSION_OR_LATER="及以上版本"MSG_JAVA_VERSION_LATEST="(最新版本)"MSG_JAVA_VERSION_MAX="最高为 %s"MSG_NO_SUITABLE_JAVA_CHECK="请确保系统中安装了所需的Java版本"MSG_INSTALL_JAVA="你需要在Mac中安装Java运行环境!\n访问 java.com 了解如何安装。"MSG_LATER="稍后"MSG_VISIT_JAVA_DOT_COM="Java by Oracle"MSG_VISIT_ADOPTOPENJDK="Java by AdoptOpenJDK" # English default localizationelseMSG_ERROR_LAUNCHING="ERROR launching '${CFBundleName}'."MSG_MISSING_MAINCLASS="'MainClass' isn't specified!\nJava application cannot be started!"MSG_JVMVERSION_REQ_INVALID="The syntax of the required Java version is invalid: %s\nPlease contact the App developer."MSG_NO_SUITABLE_JAVA="No suitable Java version found on your system!\nThis program requires Java %s"MSG_JAVA_VERSION_OR_LATER="or later"MSG_JAVA_VERSION_LATEST="(latest update)"MSG_JAVA_VERSION_MAX="up to %s"MSG_NO_SUITABLE_JAVA_CHECK="Make sure you install the required Java version."MSG_INSTALL_JAVA="You need to have JAVA installed on your Mac!\nVisit java.com for installation instructions..."MSG_LATER="Later"MSG_VISIT_JAVA_DOT_COM="Java by Oracle"MSG_VISIT_ADOPTOPENJDK="Java 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 2>&1 | 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=$1java8pattern='1\.[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 JVMstub_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 ==  ${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 3 else# 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 1fifi   # 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 2fi   # execute $JAVACMD and do some preparation############################################ # enable drag&drop to the dock iconexport CFProcessPath="$0" # remove Apples ProcessSerialNumber from passthru arguments (#39)if [[ "$*" == -psn* ]] ; thenArgsPassthru=()elseArgsPassthru=("$@")fi # change to Working Directory based upon Apple/Oracle Plist infocd "${WorkingDirectory}" || exit 13stub_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 Drag'n'Drop to Finder iconstub_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工具

点击左上角的文件夹图标

,

将包含.class文件的文件夹拖到该区域,注意这里将文件夹拖入才可以哦!!!例如本例中将文件夹mashibing拖到框内:

在这里插入图片描述

选择一个.class文件打开,例如本例中选中TestJava.class文件,你也可以随意选中一个文件打开都行,不一定是.class格式,然后点击右下角打开按钮:

在这里插入图片描述

可以看到左边是文件夹目录栏,右边就是.class反编译后的内容,如果本来就是.java文件,就不会备反编译:

在这里插入图片描述
在这里插入图片描述
可以看出来,.java文件被编译成.class文件后,我们的注释和空格都被去掉了,所以反编译出来的内容也不包含注释和空格。

来源地址:https://blog.csdn.net/SSY_1992/article/details/130282143

--结束END--

本文标题: Mac 安装Java反编译工具JD-GUI

本文链接: https://www.lsjlt.com/news/386013.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Mac 安装Java反编译工具JD-GUI
    一、下载JD-GUI软件 首先到Github下载JD-GUI软件: github java-decompiler/jd-gui Public 选择jd-gui-osx-1.6.6.tar. 解压打开软...
    99+
    2023-08-31
    macos java bash jd-gui
  • Android 反编译工具 jadx-gui
    jadx-gui 是一种基于 jadx 项目的图形界面工具,用于反编译 Android 应用程序的工具。通过使用jadx-gui,开发人员可以打开 APK(Android应用程序包)文件,并查看其反编译的源代码。这对于分析、理解和调试 An...
    99+
    2023-10-01
    android 反编译
  • jar包反编译工具(java-decompiler)
    五种反编译工具 1.jd-gui 下载地址:http://java-decompiler.github.io/ 优点:反编译的源代码基本符合,没有乱七八糟新增的修饰符 缺点:反编译过程耗时较长(50MB需要10分钟左右)       ...
    99+
    2023-08-31
    jar java
  • Java反编译工具有哪些
    这篇文章主要介绍“Java反编译工具有哪些”,在日常操作中,相信很多人在Java反编译工具有哪些问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Java反编译工具有哪些”的疑惑有所帮助!接下来,请跟着小编一起来...
    99+
    2023-06-04
  • 三款反编译工具
    一,Luyten是一款很强大的反编译工具包,是一款github的开源工具,软件功能非常强大,界面简洁明晰、操作方便快捷,设计得很人性化。 比较精准的一个java反编译工具,笔者有时候用jd-gui反编译不出来的class用luyten都可...
    99+
    2023-10-27
    jar maven java
  • 【Java可执行命令】(四)反编译工具javap:深入解析应用程序反编译工具javap ~
    Java可执行命令详解之javap 1️⃣ 概念2️⃣ 优势和缺点3️⃣ 使用3.1 语法格式3.1.1 可选参数:-l3.1.2 可选参数:-c3.1.3 可选参数:-s3.1.4 可选参数...
    99+
    2023-09-16
    java python 开发语言 java-ee jvm 后端
  • jadx反编译工具的使用
    目录 jadx工具介绍 jadx工具的安装 jadx工具的使用 jadx遇到的问题 jdk和jre的区别 jadx工具介绍 decompile Dalvik bytecode to java classes from APK, dex, ...
    99+
    2023-09-03
    gradle android android studio
  • EXE反编译方法及工具
    EXE文件是Windows操作系统下的可执行文件,通常是由C++、C#、Delphi等语言编写而成的。反编译EXE文件意味着将其转化...
    99+
    2023-09-13
    EXE
  • c反编译工具reflector用法
    Reflector是一个强大的C#反编译工具,可以将编译后的程序集反编译为C#代码。下面是Reflector的用法:1. 下载和安装...
    99+
    2023-09-17
    reflector
  • 使用jd-gui反编译修改jar包里的.class并重新生成新jar
    准备工具:jd-gui.exe反编译工具下面以我本地修改graphql-java-15.0.jar包为例: 准备jar包,新建origin文件夹,将jar包通过win.rar或当前文件夹cmd运行解压命令jar -xvf graphql-j...
    99+
    2023-08-21
    jar java jvm
  • ubuntu交叉编译工具如何安装
    要安装Ubuntu的交叉编译工具,您可以按照以下步骤进行操作:1. 打开终端窗口。2. 更新软件包列表,运行以下命令:sudo ap...
    99+
    2023-09-20
    ubuntu
  • .net的反编译工具有哪些
    这篇文章主要介绍了.net的反编译工具有哪些的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇.net的反编译工具有哪些文章都会有所收获,下面我们一起来看看吧。Reflector   ...
    99+
    2023-06-27
  • ubuntu交叉编译工具怎么安装
    要在Ubuntu上安装交叉编译工具,您可以按照以下步骤进行操作:1. 打开终端。2. 更新软件包列表:`sudo apt updat...
    99+
    2023-08-11
    ubuntu
  • mac如何编译安装 php7
    这篇文章主要介绍mac如何编译安装 php7,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!mac编译安装php7的方法:1、通过“wget -c http://mirrors.sohu.com/php/php-7.1...
    99+
    2023-06-22
  • Java 反编译工具的对比以及使用方法
    今天就跟大家聊聊有关Java 反编译工具的对比以及使用方法,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。前言Java 反编译,一听可能觉得高深莫测,其实反编译并不是什么特别高级的操作...
    99+
    2023-06-15
  • c语言反编译工具有哪些
    以下是一些常见的C语言反编译工具:1. IDA Pro:一款功能强大的静态反汇编和调试工具,可以用于反编译C语言程序。2. Ghid...
    99+
    2023-09-29
    c语言
  • 7 款开源Java反编译工具分别是哪些
    7 款开源Java反编译工具分别是哪些,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。今天我们要来分享一些关于Java的反编译工具,反编译听起来是一个非常高上大的技术词汇,通俗的...
    99+
    2023-06-17
  • Android Spider JDAX-GUI 反编译工具下载使用以及相关技术介绍
    文章目录 前言一、JDAX下载二、基本使用2.1 解压zip2.2 Java环境2.3 进入Dos命令窗口启动Jdax-Gui2.4 正常使用 三、常见的反编译工具以及简单分析介绍1.Android Killer2.Dex2...
    99+
    2023-08-24
    JDAX-GUI 反编译 网络爬虫 java windows
  • eclipse怎么安装jad反编译
    要在Eclipse中安装JAD反编译工具,可以按照以下步骤进行操作:1. 下载JAD反编译工具的JAR文件。可以在网上搜索"down...
    99+
    2023-09-07
    eclipse jad
  • 好用的android反编译工具有哪些
    以下是一些常用的Android反编译工具:1. jadx:一款开源的Java反编译工具,可以将apk文件转换为java源代码。2. ...
    99+
    2023-08-19
    android
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作