毎回どこなのかググるので。
まずは、mdfind
で Android Studio のインストールされているパスを取得します。
mdfind – macOSのCLIでもSpotlightを使ってファイルを高速全文検索する | DevelopersIO
❯ mdfind kMDItemCFBundleIdentifier="com.google.android.studio*"
/Users/mao/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app
/Users/mao/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-1/223.7571.182.2231.9523943/Android Studio Preview.app
JetBrains Toolbox で Android Studio Preview版 も入れてるので複数見つかります。
JetBrains Toolbox で Android Studio の Stable/Beta/Canary が同時に管理できる?
パス内の 221.6008.13.2211.9477386
のような文字列は、Android Studio のリリースバージョンです。
Android Studio Releases List | IntelliJ Platform Plugin SDK
find | grep
して JDK の Home
を探します。
❯ find "/Users/mao/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app" \
| grep -E "/(jdk|jbr)/Contents/Home$"
/Users/mao/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app/Contents/jbr/Contents/Home
Home
のパスが見つかったらバージョンを確認してみます。
"/Users/mao/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app/Contents/jbr/Contents/Home/bin/java" --version
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
OpenJDK 64-Bit Server VM (build 11.0.15+0-b2043.56-8887301, mixed mode)
というかんじをスクリプトにしておきます。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash
IFS=$'\n' apps=$(mdfind kMDItemCFBundleIdentifier="com.google.android.studio*")
for app in $apps
do
# echo "$app"
home=$(find "$app" | grep -E "/(jdk|jbr)/Contents/Home$")
version=$("${home}/bin/java" --version)
echo "\"$home\""
echo "$version"
echo
done
echo "https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html"
JDK の Home パスとバージョンが表示されます。
❯ find-androidstudio-embedded-jdk.sh
"/Users/mao/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app/Contents/jbr/Contents/Home"
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
OpenJDK 64-Bit Server VM (build 11.0.15+0-b2043.56-8887301, mixed mode)
"/Users/mao/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-1/223.7571.182.2231.9523943/Android Studio Preview.app/Contents/jbr/Contents/Home"
openjdk 17.0.5 2022-10-18
OpenJDK Runtime Environment (build 17.0.5+0-17.0.5b653.25-9484017)
OpenJDK 64-Bit Server VM (build 17.0.5+0-17.0.5b653.25-9484017, mixed mode)
https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
mdfind
って便利で高速です。
Android Studio Electric Eel | 2022.1.1 の JDK11 設定
macOS (Intel) + Homebrew の JDK の現状を確認する