Reputation: 15314
How do I set up my IntelliJ IDEA environment up for JDK8 development? I'm running IntelliJ IDEA 2017.1.3 Community Edition.
There are miscellaneous settings for the Java set up throughout the IDE and from time to time I find all the hiding places and get it set up. I need to occasionally switch between JDK6 and JDK8 development, so it's not quite as simple as reinstall and pick JDK8 for everything. I need to find all the switches in the IDE so I can switch between the two (and show others how to do it) setups reliably.
Please help me find all the settings and correct values to have a positive JDK6 and JDK8 experience
No SDK
I went through and set all of my "Project Settings" as listed above to JDK8 equivalents. In addition, I ran into a defect in pre 2017.2 version of IDEA IntelliJ which sets target versions to 1.5 unexpectedly. https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000347524-Java-Compiler-target-bytecode-version-Keeps-reverting-to-1-5
According to the post I need to make some hacks to my maven pom.
<properties>
<!-- necessary for intellij to function -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Upvotes: 2
Views: 5801
Reputation: 5095
Under File
/Project structure
under the Project
section each project has its JDK configured by a dropdown. Select the one you want to use and you should be done.
The same section have a project language level, which you probably want to make sure it is "SDK default" which means if you pick java 8 as the project SDK, you will also get to use java 8 features such as lambdas.
The available JDKs are configured globally (one-time operation). I usually add one for each major java version, and edit it when I upgrade to a later update.
Unless you have modules within your project that uses different java versions, you can leave the module settings to defaults.
Hope this helps.
Upvotes: 1