0
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?

More than 1 year has passed since last update.

homebrewでインストールしたjava runtimeのパス設定がうまくいかない場合

Posted at

HomebrewでインストールしたOpenJDKのパスは、

brew --prefix openjdk@11

コマンドで確認することができます。

上記のコマンドを実行すると、OpenJDKがインストールされている場所のパスが表示されます。出力されたパスを使って、シェルの設定ファイルにJavaへのパスを設定します。

zshを使っていると仮定すると、そのパスを.zshrcに追加するためのコマンドは次のようになります:

echo 'export PATH="$(brew --prefix openjdk@11)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

ここまでできたら、

java -version

openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment Homebrew (build 11.0.19+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.19+0, mixed mode)

のような表示を確認できるはず。

0
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
0
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?