IntelliJ compile for Java 7 JRE using Java 8 SDK
Solution 1
File -> Settings -> Compiler -> Java Compiler -> Project bytecode version -> 1.7
Solution 2
- Select root of your project.
- Press F4
- Select language level.
Related videos on Youtube
Comments
-
arik almost 2 years
I have the Java 8 SDK and runtime, and a project that is only using Java 7 features. I was wondering whether I could set up intellij to build a Java-7-level jar, something that is definitely possible from command line?
So far, I have tried simply setting the project language level to 7 as an experiment, but that is obviously insufficient and not really what I need.
I have also seen this question on SO: "Intellij IDEA using java7 compiler to compile when I have configured it to use Java6", but my project SDK is already set up to the newest Java version, and I merely need a Java-7-compatible artifact/jar compilation.
EDIT: I only have Java 6 and Java 8 JREs/SDKs on my local system because unfortunately Java 7 has issues on my system and is not compatible.
-
EpicPandaForce almost 10 yearsI think you need to set the project language level. Eclipse could do this too using a lower version compiler, so I'm fairly certain IntelliJ can do it too.
-
arik almost 10 yearsI've already tried that, but it didn't work. (See 2nd paragraph)
-
Vishy almost 10 yearsCan you clarify "that is obviously insufficient and not really what I need." Which build tool are you using e.g.
ant
ormaven
? -
EpicPandaForce almost 10 yearsah, found it, I'll post an answer
-
-
Benjamin R over 9 yearsYou have to have this set as well really to actually solve the OP's problem. It certainly solved it for me.
-
Prabo over 5 yearsYou saved my day