<div dir="ltr">Hi DM<div><br></div><div style>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.</div>
<div style><br></div><div style>I&#39;ve hit that several times on STEP, where I&#39;ve targeted a java 7 method by without realising.</div><div style><br></div><div style>Chris</div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On 8 March 2013 14:38, DM Smith <span dir="ltr">&lt;<a href="mailto:dmsmith@crosswire.org" target="_blank">dmsmith@crosswire.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When compiling for source=&quot;1.5&quot; I&#39;ve been seeing a message that bootclasspath has not been set.<br>
<br>
In researching this found out some interesting things.<br>
<br>
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.<br>
<br>
I&#39;ve not seen any problems with this. But it can create runtime exceptions or changes in behavior.<br>
<br>
Here is an example of the problem:<br>
Let&#39;s say we&#39;re targeting Java 6 but using Java 7 to compile and Java 7 has an overloaded method not present in 6.<br>
<br>
Java 6:<br>
interface foo {<br>
        boolean isValid(int x);<br>
}<br>
<br>
Java 7:<br>
interface foo {<br>
        boolean isValid(int x);<br>
        boolean isValid(long x);<br>
}<br>
<br>
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&#39;t run using a Java 6 jre.<br>
<br>
The solution<br>
* use at the same level as the lowest allowed runtime<br>
 or<br>
* supply the rt.jar (classes.jar on the mac) matching the lowest allowed runtime as the argument for the bootclasspath.<br>
<br>
We need to do this both in the ant and maven builds. Currently, we require Java 5.<br>
<br>
In Him,<br>
        DM<br>
<br>
<br>
_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div>