IntelliJ compile for Java 7 JRE using Java 8 SDK

允我心安 提交于 2020-01-13 07:38:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!