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?

IntelliJ + WSL2でプロジェクトが正しく読み込まれない時の対処法

Posted at

問題

  • ディレクトリが正しく読み込まれない
  • Project StructureでSDKとモジュールが空になっている

解決手順

  1. WSLにJDKをインストール

    sudo apt update
    sudo apt install openjdk-21-jdk
    
  2. JDKの場所を確認

    ls /usr/lib/jvm/
    # または
    update-alternatives --list java
    
  3. IntelliJの設定

  • Project Structure を開く(⌘; または Ctrl+Alt+Shift+S)
  • 左側の「Project」を選択
    • 「Project SDK」→「Add SDK」→「JDK」
    • WSLのJDKパスを指定(例:/usr/lib/jvm/java-21-openjdk-amd64
  • 同様に「module」タブ選択
      • で新規モジュール追加
    • 場所はprojectのrootディレクトリ
    • ビルドシステム intelliJ
    • jdk 先ほどダウンロードしたやつ
  • 作成

これで自分は読み込まれるようになりました。

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?