When using the Java compiler (javac
), we can specify two kinds of compatibility. One is using -source
and the other is using -target
.
The -source
indicates what level of compliance your source code has: are you using Annotations? Then you would need at least 1.5
; are you using @override
on interface implementations, you would need 1.6
etc
The -target
specifies what Java version you want to be able to run your classes on. You could use a Java SE 7
compiler and compile to run on Java SE 1.5
.