Nachdem ich dieses Problem heute behandelt hatte, durchsuchte ich auch das Internet und konnte keine klare Antwort finden. In meinem Fall war die Verwendung einer höheren Java-Version nicht möglich, da das Projekt in JDK 6 implementiert werden sollte. Am Ende fand ich jedoch die Lösung, hoffe, dass es jemand anderem helfen wird.
Schlüsselpunkt ist Java ist abwärtskompatibel.
Das ist die Antwort :). Sie können eine höhere JDK
Version wie 1.7 or 1.8
verwenden, um Ihr Projekt zu kompilieren und -target
Option zu verwenden, um kompilieren zu niedrigerer Version.
-target version
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1, 1.2, 1.3, 1.4, 1.5 (also 5), 1.6 (also 6), and 1.7 (also 7).
The default for -target depends on the value of -source:
If -source is not specified, the value of -target is 1.7
If -source is 1.2, the value of -target is 1.4
If -source is 1.3, the value of -target is 1.4
If -source is 1.5, the value of -target is 1.7
If -source is 1.6, the value of -target is 1.7
For all other values of -source, the value of -target is the value of -source.
Ref: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html
Ich war mit Maven so musste ich einfach <java.version>
Eigenschaft im POM
ändern, und das war es. Ich benutzte immer noch Java 8, mit dem letzten Maven, aber Maven kompilierte sich zu JDK6.
Dies sollte nicht die akzeptierte Antwort sein. Siehe Nikkis Antwort. http://StackOverflow.com/a/35544977/423045 – Jesse