IDEA配置JDK

目录

一、jdk安装以及版本

1、安装jdk17

2、确保系统环境变量配置是jdk17

二、maven版本配置

1、修改settings.xml配置文件

三、IDEA配置JDK

1、为当前项目配置jdk

2、查看项目JDK版本是否正确

3、全局配置JDK

四、setting其他检查

[1、 Runner](#1、 Runner)

[2、Java Compiler](#2、Java Compiler)


前言:SpringBoot项目开发jdk配置,本文JDK17为例

一、jdk安装以及版本

1、安装jdk17

2、确保系统环境变量配置是jdk17

复制代码
# cmd 输入
java -version

二、maven版本配置

1、修改settings.xml配置文件

复制代码
	<!-- ${MAVEN_HOME}/conf/settings.xml 文件添加如下profile配置,建立的java项目默认使用java 17 -->
	
    <profile>
        <id>jdk-17</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>17</jdk>
        </activation>
        <properties>
            <maven.compiler.source>17</maven.compiler.source>
            <maven.compiler.target>17</maven.compiler.target>
            <maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
        </properties>
    </profile>  
	<!--
	    <profile>
        <id>jdk-1.8</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.8</jdk>
        </activation>
        <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
        </properties>
    </profile>
-->
  </profiles>

三、IDEA配置JDK

1、为当前项目配置jdk

依次点击菜单栏 File -> Project Structrue

点击 SDKs -> + -> Add JDK,开始添加新的 JDK,选择新的 JDK 安装目录,这里新添加的 JDK 17, 然后点击【OK】按钮 :(如果存在略过)

2、查看项目JDK版本是否正确

依次点击菜单栏 File -> Project Structrue

3、全局配置JDK

点击 File -> New Projects Setup -> Structure -> Project 下的 SDK 选项,将其更改为你最常用的 JDK 版本

四、setting其他检查

1、 Runner

2、Java Compiler

相关推荐
程序员黑豆2 小时前
Java包装类:基本类型与对象的桥梁
java·前端·ai编程
hsjiasb5 小时前
FreeRTOS学习(二十七)——任务栈与栈溢出检测
开发语言·stm32·学习·学习笔记·freertos
丰锋ff6 小时前
3.1 Qt事件之事件处理器
开发语言·qt
多弗朗皮卡丘6 小时前
C语言梦开始的地方7:函数
c语言·开发语言
mldong6 小时前
"applicant" 契约:退回发起人的闭环设计
java·架构
月华路6 小时前
G1 垃圾回收:脏卡队列、记忆集与并发精化线程机制
java·开发语言
gugucoding7 小时前
47. 【Java】Java内存模型(JMM)与可见性
java·开发语言
m0_380743877 小时前
从零调用 Claude 教程
开发语言·python·node.js
起床学FPGA7 小时前
AI回答问题之后,会自动跳到最下面的问题
开发语言·javascript·ecmascript
zww89491117 小时前
校园跑腿系统开发实战指南:从需求分析到上线部署全流程解析
java