Programing

IntelliJ IDEA 기본 JDK를 어떻게 변경합니까?

lottogame 2020. 5. 15. 08:00
반응형

IntelliJ IDEA 기본 JDK를 어떻게 변경합니까?


IntelliJ IDEA를 개발 환경으로 사용하고 Maven을 종속성 관리에 사용합니다. IDEA 외부에서 프로젝트 구조 (디렉토리, 폼 등)를 자주 빌드 한 다음을 사용하여 프로젝트를 IDEA로 가져옵니다 Import project from external model. 이것은 내 pom에서 maven-compiler-plugin이 JDK 1.6을 사용해야한다고 지정하고 가져올 때 IDEA가 Language Level Changedand and that을 알려주고 Language level changes will take effect on project reload프로젝트를 다시로드하라는 메시지를 표시 한다는 점을 제외하고는 훌륭하게 작동합니다 . 항상 같은 JDK 버전을 사용하기 때문에 성가신 일입니다.

새 프로젝트를 가져올 때마다 프로젝트를 다시로드 할 필요가 없도록 IntelliJ IDEA가 사용하는 기본 JDK를 어떻게 변경합니까?


이 설정은 "기본 프로젝트 구조 ..."대화창에서 변경됩니다. "파일"-> "기타 설정"-> "기본 프로젝트 구조 ..."로 이동하십시오.

기본 프로젝트 구조 선택

그런 다음 "프로젝트 언어 수준"설정을 원하는 언어 수준으로 수정하십시오.

프로젝트 언어 레벨 설정

IntelliJ IDEA 12의 "기본 프로젝트 구조 ..."대신 "템플릿 프로젝트 구조 ..."에서이 설정이 사용되었습니다.


  • IntelliJ IDEA 14.0.3을 사용하고 있으며 동일한 질문이 있습니다. 메뉴를 선택 File\ Other Settings\Default Project Structure...

여기에 이미지 설명을 입력하십시오

  • 선택 Project탭 섹션에서 Project language level드롭 다운 목록에서 레벨을 선택,이 설정입니다 default for all new project.

    여기에 이미지 설명을 입력하십시오

JDK 아카이브 파일 (.tar.gz)을 다운로드하여 압축을 풀고 '프로젝트 구조' 대화 상자 ( Ctrl+ Alt+ Shift+ S) 에서 SDK로 추가하십시오.

jdk 9 정보 확대하려면 gif를 클릭하십시오

' 프로젝트 언어 레벨 '도 설정하십시오 .


최신 버전의 IntelliJ IDEA에서 Java 1.8이 필요하지만 기본적으로 구성되어 있지 않습니다.

우리의 경로 또는 구성 변경할 수 있습니다 Project Settings> Project>을Project SDK

여기에서 JDK의 경로를 편집하거나 추가 할 수 있습니다.

(제 경우에는 경로가에 있습니다 C:\Program Files\Java\jdk1.8.0_102)

여기에 이미지 설명을 입력하십시오

여기에 이미지 설명을 입력하십시오


JDK 버전을 1.8로 변경

  1. 언어 레벨 파일-> 프로젝트 구조-> 모듈-> 소스-> 언어 레벨-> 8-Lambdas, 유형 주석 등 여기에 이미지 설명을 입력하십시오
  2. 프로젝트 SDk 파일-> 프로젝트 구조-> 프로젝트 1.8 여기에 이미지 설명을 입력하십시오

  3. Java 컴파일러 파일-> 설정-> 빌드, 실행, 배포-> 컴파일러-> Java 컴파일러 여기에 이미지 설명을 입력하십시오


One other place worth checking: Look in the pom.xml for your project, if you are using Maven compiler plugin, at the source/target config and make sure it is the desired version of Java. I found that I had 1.7 in the following; I changed it to 1.8 and then everything compiled correctly in IntelliJ.

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <encoding>UTF-8</encoding>
        </configuration>
    </plugin>
</plugins>
</build>

The above responses were very useful, but after all settings, the project was running with the wrong version. Finally, I noticed that it can be also configured in the Dependencies window. Idea 2018.1.3 File -> Project Structure -> Modules -> Sources and Dependencies.


To change the JDK version of the Intellij-IDE himself:

Start the IDE -> Help -> Find Action

than type:

Switch Boot JDK

or (depend on your version)

Switch IDE boot JDK

참고 : https://stackoverflow.com/questions/18987228/how-do-i-change-the-intellij-idea-default-jdk

반응형