简体   繁体   中英

IntelliJ won't recognize JDK on Ubuntu

I installed openjdk using the command:

sudo apt install openjdk-11-jre-headless

java -version command correctly displays the installed package

openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)

However, when I open the IntelliJ IDEA environment, and want to run the first project, the environment does not detect the sdk

Should I configure something else beforehand, I haven't had much experience with Ubuntu before, for comparison in windows using the command -java version I get this message: completely different from what I get on ubuntu and everything works fine

java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

That's because you've installed JRE instead of JDK . see: What is the difference between JDK and JRE?

Just try sudo apt install openjdk-17-jdk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM