简体   繁体   English

IntelliJ 无法在 Ubuntu 上识别 JDK

[英]IntelliJ won't recognize JDK on Ubuntu

I installed openjdk using the command:我使用以下命令安装了openjdk

sudo apt install openjdk-11-jre-headless

java -version command correctly displays the installed package java -version命令正确显示已安装的包

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但是,当我打开IntelliJ IDEA环境,想运行第一个项目时,环境没有检测到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我是否应该事先配置其他东西,我以前对 Ubuntu 没有太多经验,为了在 windows 中使用命令-java version进行比较,我收到以下消息:与我在 ubuntu 上得到的完全不同,一切正常

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 .那是因为您安装了JRE而不是JDK see: What is the difference between JDK and JRE?请参阅: JDK 和 JRE 有什么区别?

Just try sudo apt install openjdk-17-jdk只需尝试sudo apt install openjdk-17-jdk

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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