Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ compile for Java 7 JRE using Java 8 SDK

Tags:

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.

like image 553
arik Avatar asked Aug 04 '14 09:08

arik


People also ask

Does IntelliJ use JDK or JRE?

To develop applications in IntelliJ IDEA, you need a Java SDK (JDK). A JDK is a software package that contains libraries, tools for developing and testing Java applications (development tools), and tools for running applications on the Java platform (Java Runtime Environment — JRE).


2 Answers

File -> Settings -> Compiler -> Java Compiler -> Project bytecode version -> 1.7

like image 77
EpicPandaForce Avatar answered Oct 01 '22 07:10

EpicPandaForce


  • Select root of your project.
  • Press F4
  • Select language level.

enter image description here

like image 26
Yurii Bondarenko Avatar answered Oct 01 '22 05:10

Yurii Bondarenko