When using the Java compiler (javac
), we can specify two kinds of compatibility. One is using -source
and the other is using -target
. What is the difference between these two?
For example, -source 1.5
and -target 1.6
?
Also, is there any case where we use a different source and target compatibility level?
Compatibility in a relationship means that both partners understand and accept each other's life philosophy and goals, as well as genuinely enjoy being around each other without feeling preoccupied by what they feel needs to change within their partner.
Compatibility controls the partitioning of different elements during melting. The compatibility of an element in a rock is a weighted average of its compatibility in each of the minerals present. By contrast, an incompatible element is one that is least stable within its crystal structure.
Compatibility is deeper and more logical than chemistry. “[Compatibility is about] the various elements of lifestyle, values, and goals that feel in line with one another and how that manifests in your interactions,” says AH.
Ted Hudson, PhD, told Thrive Global that his research has shown "there's no difference in the objective compatibility between couples who are unhappy and those who are happy." He found compatibility wasn't an issue for couples who were happy in their relationships: Those couples made it clear that their will to keep ...
From the javac docs:
-source Specifies the version of source code accepted.
-target 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.
In your example:
-source 1.5 and -target 1.6
This would be used to make sure that the source code is compatible with JDK 1.5, but should generate class files for use on JDK 1.6 and later.
Quite why you would do this is another matter.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With