Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between using JDK 7 vs using JDK 8 with compiler compliance level 1.7?

Tags:

java

android

I was wondering if there is any difference running/building a software under JDK 8 and using compiler compliance level 1.7 vs JDK 7 as system default? I am more interested in reference to Android building, building apps, Eclipse, Android Studio, etc.

like image 892
Sudhir Singh Khanger Avatar asked Dec 03 '14 17:12

Sudhir Singh Khanger


People also ask

Is Java 1.7 the same as Java 7?

javac -source 1.7 (is an alias for javac -source 7 ) java.

What is JDK compliance level?

The "Compiler Compliance Level" setting equates to the -source option to javac. It indicates which JDK level the source should conform to. This setting does not have to be the same as the JDK level. For example, your default JDK could be 1.6 but the source set to 1.4.

What is the difference between JDK 1.8 and 8?

http://www.oracle.com/technetwork/java/javase/jdk8-naming-2157130.html Java SE Development Kit 8, also known as JDK 8, has the version number 1.8. In short – 8 is product version number and 1.8 is the developer version number (or internal version number). The product is the same, JDK 8, anyways.

Is Java 1.8 backwards compatible?

Java SE 8 is binary-compatible with Java SE 7 except for the incompatibilities listed below. Except for the noted incompatibilities, class files built with the Java SE 7 compiler will run correctly in Java SE 8. Class files built with the Java SE 8 compiler will not run on earlier releases of Java SE.


2 Answers

Yes, there are loads of new classes in the JDK 1.8, for example, the java.time classes. You won't get those if you build in JDK 1.7; but you will be able to use them if you build in JDK 1.8 with compiler compliance level 1.7.

like image 97
Dawood ibn Kareem Avatar answered Sep 22 '22 03:09

Dawood ibn Kareem


Yes there is a difference between running/building a software under JDK 8 and using compiler compliance level 1.7 vs JDK 7 as system default.

  1. running a software under JDK 8 and using compiler compliance level : You compile in jdk 1.7 but run on 1.8. No problem, your programm will work as needed.

  2. JDK 7 as system default : You compile in 1.7 version and run on the same version.

I am wondering in waht case you would like to use the first case ?

like image 34
Pracede Avatar answered Sep 26 '22 03:09

Pracede