「Failed to create the Java Virtual Machine」となってDBeaverが起動出来ない時の対処法
最終更新から6年以上たっています。ライブラリのバージョンや手順が変わっている可能性があります。
こんにちは。趣味グラマのNobu(@nm_aru)です。
どのタイミングかは不明ですが、恐らくbrew cask upgradeしたタイミングで、DBeaverのバージョンが上がり、以下のエラーが出てDBeaverが起動出来なくなってしまいました。
Failed to create the Java Virtual Machine.

困った時のGoogle先生に聞いたところ、Info.plistを変更する事で解決したので、備忘録として残しておきたいと思います。
Info.plistを編集し、使用したいJDKのjavaコマンドにPathを通す
Just a moment...
JavaコマンドのPathを確認
私の場合は以下の場所にJavaコマンドがあります。
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/bin/java
人によって使っているJDKの種類やバージョンが違う場合もあるので、その時は「/Library/Java/JavaVirtualMachines」以下から自分が使っているJDKのディレクトリを辿りましょう。
DBeaverのInfo.plistを編集する
以下の場所にあるInfo.plistを開き、一番下の方にあるVMの設定のところに、先ほどのJavaコマンドのPathを追記します。
/Applications/DBeaver.app/Contents/Info.plist
長いですが、追加したのは58行目だけです。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>dbeaver</string>
<key>CFBundleGetInfoString</key>
<string>Universal Database Manager and SQL client.</string>
<key>CFBundleIconFile</key>
<string>dbeaver.icns</string>
<key>CFBundleIdentifier</key>
<string>org.jkiss.dbeaver.core.product</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>DBeaver Community</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>7.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>7.0.2</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
</array>
<key>CFBundleDisplayName</key>
<string>DBeaver Community</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>sql</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>dbeaver.icns</string>
<key>CFBundleTypeName</key>
<string>SQL file</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>SQL</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>Eclipse</key>
<array>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options:
<string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java</string>
<string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java</string>
-->
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/bin/java</string>
<string>-keyring</string><string>~/.eclipse_keyring</string>
<!-- WARNING:
If you try to add a single VM argument (-vmargs) here,
*all* vmargs specified in eclipse.ini will be ignored.
We recommend to add all arguments in eclipse.ini
-->
</array>
</dict>
</plist>編集完了後、再度DBeaverを起動してみると、無事起動出来るようになりました。
まとめ
今回のように、アプリ内のファイルを直接編集してエラーを回避するという方法は、何かの拍子(アプリのアップグレードとか)にファイルが元に戻ると、また同じエラーに遭遇しかねないので、あまり好きな方法では無いのですが、とりあえずさっさと使える状態に戻したかったので、この方法を選択しました。
ブログに書いておけば、もしもの時に思い出せる可能性が多少上がると信じて(^^)
開発ツール の記事
コメントの受け付けは終了しました。ご意見・ご質問は X(@nm_aru)へどうぞ。


コメント(1件)
参考になりました。ありがとうございます!