$ java -versionjava version "1.8.0_20-ea"
Java 1.8 == 8 == 52 (go figure why this confusion)
J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45
Solution 1: update Java version on target machine (often impossible)
Solution 2: compile with lower Java version (skip on fancy language features e.g. lambdas)
e.g. using Maven
<build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<!-- target has java version "1.7.0_60", to be safe we use 1.6 -->
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
e.g. using Java Compiler
No comments:
Post a Comment