Как изменить версию java intellij idea

I use IntelliJ IDEA as my development environment, and Maven for dependency management. I frequently build my project structure (directories, poms, etc) outside of IDEA and then import the project...

I use IntelliJ IDEA as my development environment, and Maven for dependency management. I frequently build my project structure (directories, poms, etc) outside of IDEA and then import the project into IDEA using Import project from external model. This works great, except that in my poms I specify that the maven-compiler-plugin should use JDK 1.6, and when I import, IDEA informs me that the Language Level Changed and that Language level changes will take effect on project reload, and then prompts to reload the project. This is annoying because I always use the same JDK version.

How do I change the default JDK that IntelliJ IDEA uses, so that I don’t have to reload my project every time I import a new project?

asked Sep 24, 2013 at 16:34

GamerJosh's user avatar

This setting is changed in the «Structure for New Projects» dialog. Navigate to «File» -> «New Projects Setup» -> «Structure…»

Selecting Structure For New Projects

Next, modify the «Project SDK» and «Project Language Level» as appropriate.

Selecting Project Language Level


Previous versions of IntelliJ IDEA had this setting in «File» -> «Other Settings» -> «Default Project Structure…».

IntelliJ IDEA 12 had this setting in «Template Project Structure…» instead of «Default Project Structure…»

3

Download and unpack a JDK archive file (.tar.gz) and add it as a SDK in the ‘Project Structure’ dialog box ( Ctrl+Alt+Shift+S )

jdk 9 intellij
click on the gif to enlarge

Also make sure to set an appropriate ‘Project language level’. I forgot to do that when creating the GIF.

Project Structure > Project > Project language level

For Java 8 set it to 8, for Java 9 set it to 9, and so on.

answered Mar 5, 2018 at 7:55

Gayan Weerakutti's user avatar

Gayan WeerakuttiGayan Weerakutti

11.1k1 gold badge67 silver badges66 bronze badges

  • I am using IntelliJ IDEA 14.0.3, and I also have same question. Choose menu File Other Settings Default Project Structure...

enter image description here

  • Choose Project tab, section Project language level, choose level from dropdown list, this setting is default for all new project.

    enter image description here

Community's user avatar

answered Feb 14, 2015 at 15:36

Raphaël Colantonio's user avatar

I have found out that in recent versions of IntelliJ IDEA requires Java 1.8 but is not configured by default.

We can change the path or configure from Project Settings > Project > Project SDK

here we can edit or add the JDK´s path.

(in my case the path is located in C:Program FilesJavajdk1.8.0_102)

enter image description here

enter image description here

answered Feb 1, 2017 at 17:49

Jorgesys's user avatar

JorgesysJorgesys

123k23 gold badges328 silver badges264 bronze badges

Change JDK version to 1.8

  1. Language level File -> project Structure -> Modules -> Sources -> Language level -> 8-Lambdas, type annotations etc.
    enter image description here
  2. Project SDk File -> project Structure -> Project 1.8
    enter image description here

  3. Java compiler File -> Settings -> Build, Executions, Deployment -> Compiler -> Java compiler
    enter image description here

answered May 3, 2016 at 7:47

ethemsulan's user avatar

ethemsulanethemsulan

2,20126 silver badges19 bronze badges

1

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>

Rich's user avatar

Rich

15.5k15 gold badges77 silver badges125 bronze badges

answered Apr 3, 2017 at 21:45

barclay's user avatar

barclaybarclay

4,3329 gold badges49 silver badges67 bronze badges

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.

answered May 19, 2018 at 10:00

knollmaj's user avatar

knollmajknollmaj

511 silver badge2 bronze badges

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

answered Aug 9, 2019 at 8:30

Java's user avatar

JavaJava

2,3391 gold badge10 silver badges22 bronze badges

3

For latest version intellij, to set default jdk/sdk for new projects go to

Configure->Structure for New Projects -> Project Settings -> Project SDK

answered Apr 17, 2020 at 15:42

MrKulli's user avatar

MrKulliMrKulli

72510 silver badges18 bronze badges

2

I am using IntelliJ 2020.3.1 and the File > Other Settings… menu option has disappeared. I went to Settings in the usual way and searched for «jdk». Under Build, Execution, Deployment > Build Tools > Maven > Importing I found the the setting that will solve my specific issue:

JDK for importer.

IntelliJ 2020.3 Settings dialog

answered Jan 27, 2021 at 14:24

cptully's user avatar

cptullycptully

5036 silver badges24 bronze badges

On my linux machine I use a script like this:

export IDEA_JDK=/opt/jdk14
/idea-IC/bin/idea.sh

answered Jul 22, 2020 at 15:03

Marinos An's user avatar

Marinos AnMarinos An

8,8115 gold badges54 silver badges92 bronze badges

I use IntelliJ IDEA as my development environment, and Maven for dependency management. I frequently build my project structure (directories, poms, etc) outside of IDEA and then import the project into IDEA using Import project from external model. This works great, except that in my poms I specify that the maven-compiler-plugin should use JDK 1.6, and when I import, IDEA informs me that the Language Level Changed and that Language level changes will take effect on project reload, and then prompts to reload the project. This is annoying because I always use the same JDK version.

How do I change the default JDK that IntelliJ IDEA uses, so that I don’t have to reload my project every time I import a new project?

asked Sep 24, 2013 at 16:34

GamerJosh's user avatar

This setting is changed in the «Structure for New Projects» dialog. Navigate to «File» -> «New Projects Setup» -> «Structure…»

Selecting Structure For New Projects

Next, modify the «Project SDK» and «Project Language Level» as appropriate.

Selecting Project Language Level


Previous versions of IntelliJ IDEA had this setting in «File» -> «Other Settings» -> «Default Project Structure…».

IntelliJ IDEA 12 had this setting in «Template Project Structure…» instead of «Default Project Structure…»

3

Download and unpack a JDK archive file (.tar.gz) and add it as a SDK in the ‘Project Structure’ dialog box ( Ctrl+Alt+Shift+S )

jdk 9 intellij
click on the gif to enlarge

Also make sure to set an appropriate ‘Project language level’. I forgot to do that when creating the GIF.

Project Structure > Project > Project language level

For Java 8 set it to 8, for Java 9 set it to 9, and so on.

answered Mar 5, 2018 at 7:55

Gayan Weerakutti's user avatar

Gayan WeerakuttiGayan Weerakutti

11.1k1 gold badge67 silver badges66 bronze badges

  • I am using IntelliJ IDEA 14.0.3, and I also have same question. Choose menu File Other Settings Default Project Structure...

enter image description here

  • Choose Project tab, section Project language level, choose level from dropdown list, this setting is default for all new project.

    enter image description here

Community's user avatar

answered Feb 14, 2015 at 15:36

Raphaël Colantonio's user avatar

I have found out that in recent versions of IntelliJ IDEA requires Java 1.8 but is not configured by default.

We can change the path or configure from Project Settings > Project > Project SDK

here we can edit or add the JDK´s path.

(in my case the path is located in C:Program FilesJavajdk1.8.0_102)

enter image description here

enter image description here

answered Feb 1, 2017 at 17:49

Jorgesys's user avatar

JorgesysJorgesys

123k23 gold badges328 silver badges264 bronze badges

Change JDK version to 1.8

  1. Language level File -> project Structure -> Modules -> Sources -> Language level -> 8-Lambdas, type annotations etc.
    enter image description here
  2. Project SDk File -> project Structure -> Project 1.8
    enter image description here

  3. Java compiler File -> Settings -> Build, Executions, Deployment -> Compiler -> Java compiler
    enter image description here

answered May 3, 2016 at 7:47

ethemsulan's user avatar

ethemsulanethemsulan

2,20126 silver badges19 bronze badges

1

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>

Rich's user avatar

Rich

15.5k15 gold badges77 silver badges125 bronze badges

answered Apr 3, 2017 at 21:45

barclay's user avatar

barclaybarclay

4,3329 gold badges49 silver badges67 bronze badges

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.

answered May 19, 2018 at 10:00

knollmaj's user avatar

knollmajknollmaj

511 silver badge2 bronze badges

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

answered Aug 9, 2019 at 8:30

Java's user avatar

JavaJava

2,3391 gold badge10 silver badges22 bronze badges

3

For latest version intellij, to set default jdk/sdk for new projects go to

Configure->Structure for New Projects -> Project Settings -> Project SDK

answered Apr 17, 2020 at 15:42

MrKulli's user avatar

MrKulliMrKulli

72510 silver badges18 bronze badges

2

I am using IntelliJ 2020.3.1 and the File > Other Settings… menu option has disappeared. I went to Settings in the usual way and searched for «jdk». Under Build, Execution, Deployment > Build Tools > Maven > Importing I found the the setting that will solve my specific issue:

JDK for importer.

IntelliJ 2020.3 Settings dialog

answered Jan 27, 2021 at 14:24

cptully's user avatar

cptullycptully

5036 silver badges24 bronze badges

On my linux machine I use a script like this:

export IDEA_JDK=/opt/jdk14
/idea-IC/bin/idea.sh

answered Jul 22, 2020 at 15:03

Marinos An's user avatar

Marinos AnMarinos An

8,8115 gold badges54 silver badges92 bronze badges

I use IntelliJ IDEA as my development environment, and Maven for dependency management. I frequently build my project structure (directories, poms, etc) outside of IDEA and then import the project into IDEA using Import project from external model. This works great, except that in my poms I specify that the maven-compiler-plugin should use JDK 1.6, and when I import, IDEA informs me that the Language Level Changed and that Language level changes will take effect on project reload, and then prompts to reload the project. This is annoying because I always use the same JDK version.

How do I change the default JDK that IntelliJ IDEA uses, so that I don’t have to reload my project every time I import a new project?

asked Sep 24, 2013 at 16:34

GamerJosh's user avatar

This setting is changed in the «Structure for New Projects» dialog. Navigate to «File» -> «New Projects Setup» -> «Structure…»

Selecting Structure For New Projects

Next, modify the «Project SDK» and «Project Language Level» as appropriate.

Selecting Project Language Level


Previous versions of IntelliJ IDEA had this setting in «File» -> «Other Settings» -> «Default Project Structure…».

IntelliJ IDEA 12 had this setting in «Template Project Structure…» instead of «Default Project Structure…»

3

Download and unpack a JDK archive file (.tar.gz) and add it as a SDK in the ‘Project Structure’ dialog box ( Ctrl+Alt+Shift+S )

jdk 9 intellij
click on the gif to enlarge

Also make sure to set an appropriate ‘Project language level’. I forgot to do that when creating the GIF.

Project Structure > Project > Project language level

For Java 8 set it to 8, for Java 9 set it to 9, and so on.

answered Mar 5, 2018 at 7:55

Gayan Weerakutti's user avatar

Gayan WeerakuttiGayan Weerakutti

11.1k1 gold badge67 silver badges66 bronze badges

  • I am using IntelliJ IDEA 14.0.3, and I also have same question. Choose menu File Other Settings Default Project Structure...

enter image description here

  • Choose Project tab, section Project language level, choose level from dropdown list, this setting is default for all new project.

    enter image description here

Community's user avatar

answered Feb 14, 2015 at 15:36

Raphaël Colantonio's user avatar

I have found out that in recent versions of IntelliJ IDEA requires Java 1.8 but is not configured by default.

We can change the path or configure from Project Settings > Project > Project SDK

here we can edit or add the JDK´s path.

(in my case the path is located in C:Program FilesJavajdk1.8.0_102)

enter image description here

enter image description here

answered Feb 1, 2017 at 17:49

Jorgesys's user avatar

JorgesysJorgesys

123k23 gold badges328 silver badges264 bronze badges

Change JDK version to 1.8

  1. Language level File -> project Structure -> Modules -> Sources -> Language level -> 8-Lambdas, type annotations etc.
    enter image description here
  2. Project SDk File -> project Structure -> Project 1.8
    enter image description here

  3. Java compiler File -> Settings -> Build, Executions, Deployment -> Compiler -> Java compiler
    enter image description here

answered May 3, 2016 at 7:47

ethemsulan's user avatar

ethemsulanethemsulan

2,20126 silver badges19 bronze badges

1

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>

Rich's user avatar

Rich

15.5k15 gold badges77 silver badges125 bronze badges

answered Apr 3, 2017 at 21:45

barclay's user avatar

barclaybarclay

4,3329 gold badges49 silver badges67 bronze badges

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.

answered May 19, 2018 at 10:00

knollmaj's user avatar

knollmajknollmaj

511 silver badge2 bronze badges

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

answered Aug 9, 2019 at 8:30

Java's user avatar

JavaJava

2,3391 gold badge10 silver badges22 bronze badges

3

For latest version intellij, to set default jdk/sdk for new projects go to

Configure->Structure for New Projects -> Project Settings -> Project SDK

answered Apr 17, 2020 at 15:42

MrKulli's user avatar

MrKulliMrKulli

72510 silver badges18 bronze badges

2

I am using IntelliJ 2020.3.1 and the File > Other Settings… menu option has disappeared. I went to Settings in the usual way and searched for «jdk». Under Build, Execution, Deployment > Build Tools > Maven > Importing I found the the setting that will solve my specific issue:

JDK for importer.

IntelliJ 2020.3 Settings dialog

answered Jan 27, 2021 at 14:24

cptully's user avatar

cptullycptully

5036 silver badges24 bronze badges

On my linux machine I use a script like this:

export IDEA_JDK=/opt/jdk14
/idea-IC/bin/idea.sh

answered Jul 22, 2020 at 15:03

Marinos An's user avatar

Marinos AnMarinos An

8,8115 gold badges54 silver badges92 bronze badges

Понравилась статья? Поделить с друзьями:
  • Как изменить версию hoi4 на пиратке
  • Как изменить версию hoi 4 на пиратке
  • Как изменить версию gradle android studio
  • Как изменить версию firefox
  • Как изменить версию excel