[jsword-devel] Cross-compilation
Chris Burrell
chris at burrell.me.uk
Fri Mar 8 08:06:03 MST 2013
Hi DM
One of the issues with cross-compiling, is that it does the cross-compiling
in terms of the language structures. It however bases everything on the
assumption that the JRE provides the various classes, methods, etc.
I've hit that several times on STEP, where I've targeted a java 7 method by
without realising.
Chris
On 8 March 2013 14:38, DM Smith <dmsmith at crosswire.org> wrote:
> When compiling for source="1.5" I've been seeing a message that
> bootclasspath has not been set.
>
> In researching this found out some interesting things.
>
> For a while now you could compile for a prior version of Java. So, for
> many years we used Java 5 or 6 to compile for Java 1.4 and Java 6 or 7 to
> compile for Java 5.
>
> I've not seen any problems with this. But it can create runtime exceptions
> or changes in behavior.
>
> Here is an example of the problem:
> Let's say we're targeting Java 6 but using Java 7 to compile and Java 7
> has an overloaded method not present in 6.
>
> Java 6:
> interface foo {
> boolean isValid(int x);
> }
>
> Java 7:
> interface foo {
> boolean isValid(int x);
> boolean isValid(long x);
> }
>
> The Java 7 compiler resolving a call to isValid(x) only has one choice in
> Java 6, but two in Java 7. If the compiler picks the one that is new, then
> the code won't run using a Java 6 jre.
>
> The solution
> * use at the same level as the lowest allowed runtime
> or
> * supply the rt.jar (classes.jar on the mac) matching the lowest allowed
> runtime as the argument for the bootclasspath.
>
> We need to do this both in the ant and maven builds. Currently, we require
> Java 5.
>
> In Him,
> DM
>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20130308/e4a9ab36/attachment.html>
More information about the jsword-devel
mailing list