1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

お題は不問!Qiita Engineer Festa 2024で記事投稿!
Qiita Engineer Festa20242024年7月17日まで開催中!

homebrewでjavaをインストールしたがUnable to locate a Java Runtimeエラーになった時の解消法

Posted at

背景

$ brew install java

でmac book proにインストールをしたのに

$ java --version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

になった

PCスペック

項目 情報
OS macOS Sonoma 14.4.1
ハードウェア MacBook Pro 16inc 2023
プロセッサ Apple M2 pro
メモリ 32GB

解消法

シンボリックリンクを張るといいらしい。

以下のようにして対応

javaのインストール

$ brew install java

シンボリックリンクを張る

$ sudo ln -sfn $(brew --prefix)/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
$ java --version
openjdk 22.0.1 2024-04-16
OpenJDK Runtime Environment Homebrew (build 22.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 22.0.1, mixed mode, sharing)

出来た!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?