问题
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.
回答1:
File -> Settings -> Compiler -> Java Compiler -> Project bytecode version -> 1.7
回答2:
- Select root of your project.
- Press F4
- Select language level.
来源:https://stackoverflow.com/questions/25115059/intellij-compile-for-java-7-jre-using-java-8-sdk