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
Project Settings
- IntelliJ IDEA > Preferences > Java Compiler > Project bytecode version
- 1.8
- IntelliJ IDEA > Preferences > Java Compiler > Target bytecode version
- 1.5 for all listed modules
- File > Project Structure > Project > Project SDK
- 1.8
- File > Project Structure > Project > Project language level
- 5.0 'enum' keyword, generics, autoboxing etc.
- File > Project Structure > Modules > my project's modules
- Language Level = 5.0 'enum' keyword, generics, autoboxing etc.
Settings for Creating new projects
- File > Other Settings > Default Settings > Build, Execution, Deployment > Compiler > Java Compiler > Project bytecode version
- 1.8
- File > Other Settings > Default Project Structure > Project > Project SDK
No SDK
- File > Other Settings > Default Project Structure > Project > Project language level
- 6 - @Override in interfaces
- File > Other Settings > Default Project Structure > Platform Settings > SDKs
- confirm 1.6 and 1.8 exist
Solution:
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>