On Feb 2, 9:51 am, stevecanfi...@yahoo.com wrote:
> If a developer builds something with Java jdk 6, do customers have to
> be running a Java 6 jre to run the app? If you target version 5, will
> the generated classes work on a Java 5 jre?
>
> -sc
Thats a good question.
There are some changes to the API in 1.6, but if you avoid those that
differ, I believe 1.5 and 1.6 have compatible class formats.
On Feb 3, 4:51 am, stevecanfi...@yahoo.com wrote:
> If a developer builds something with Java jdk 6, do customers have to
> be running a Java 6 jre to run the app? If you target version 5, will
> the generated classes work on a Java 5 jre?
So long as the build is done with a
-source/target of 1.5 (or lower) and
compiled against a -bootclasspath
pointing to a 1.5 (or lower) rt.jar,
then..
Yes. The code should run successfully
on 1.5 (or lower) VM's.
What pins the minimum at 1.5? Generics?
Andrew T.
stevecanfield@yahoo.com - 02 Feb 2007 18:21 GMT
> On Feb 3, 4:51 am, stevecanfi...@yahoo.com wrote:
>
[quoted text clipped - 14 lines]
>
> Andrew T.
Yeah- we make heavy use of generics.
Unfortunately we also have a class that implements java.sql.ResultSet
and that seems to have changed between 5 and 6 (now ResultSet extends
Wrapper).
So I think once we make the jump to 1.6, all of our customers will
need to as well.
sc
Andrew Thompson - 02 Feb 2007 21:22 GMT
On Feb 3, 5:21 am, stevecanfi...@yahoo.com wrote:
..
> > On Feb 3, 4:51 am, stevecanfi...@yahoo.com wrote:
>
> > > If a developer builds something with Java jdk 6, do customers have to
> > > be running a Java 6 jre to run the app? If you target version 5, will
> > > the generated classes work on a Java 5 jre?
...
> Unfortunately we also have a class that implements java.sql.ResultSet
> and that seems to have changed between 5 and 6 (now ResultSet extends
> Wrapper).
>
> So I think once we make the jump to 1.6, all of our customers will
> need to as well.
Wrong. That ResultSet now extend's Wrapper
interface is of no huge problem, perhaps unless
the application actually *de/serailizes* ResultSet's.
It merely adds to the methods that are implemented
in ResultSet (by way of the Wrapper method
contract).
Compile aginst a 1.5 rt.jar as described earlier,
and the application should run on 1.5+.
Andrew T.
On 2 Feb., 18:51, stevecanfi...@yahoo.com wrote:
> If a developer builds something with Java jdk 6, do customers have to
> be running a Java 6 jre to run the app? If you target version 5, will
> the generated classes work on a Java 5 jre?
>
> -sc
My JAR-file written with JDK 1.6.0 (Java 6) couldn't run on JRE
1.5.0_10 (which is the latest Java 5 JRE). It's also still the version
users can download from www.java.com at the moment. -But my program
wasn't targeted to version 5 (I didn't think, that I had to do that),
so one should probably just tell the compiler to do that. I hope that
it will work, when I try...
By the way, what is the target option to javac, just "javac -target 5
MyFile.java" ?
Another thing: I am trying to find a place where Java users can
download JRE 1.6.0, without having to download the whole Java
Development Kit (JDK 1.6.0) too. I didn't find JRE 6 alone on
www.java.com or java.sun.com. -Only the full package with the JDK and
JRE 6 could be downloaded.
I wonder why. Does anyone know a place to download JRE 6 alone? If JRE
6 was just freely available on www.java.com, then there wouldn't
really be any problem, of course...
Rgds,
Pete C
______________________________________________
Why not have a *free* copy of StarOffice (SO7)? Try here :
http://www.avanquest.fr/absoft/produits/promotion/enregistrement_presse/vnu/Star
Office0506/avquk_so0506.cfm
Andrew Thompson - 03 Feb 2007 07:25 GMT
> On 2 Feb., 18:51, stevecanfi...@yahoo.com wrote:
...
> By the way, what is the target option to javac, just "javac -target 5
> MyFile.java" ?
That will not guarantee code compatibility.
See my earliest reply, then RTFM.
Andrew T.
Ben Caradoc-Davies - 03 Feb 2007 22:33 GMT
> By the way, what is the target option to javac, just "javac -target 5
> MyFile.java" ?
It is more complicated than that because javac uses the java boot class
path to determine the API of the standard libraries. Sun recommend using
javac with the boot class path of the jdk for your target version. In
practice, I find it simpler to just build with the target jdk. Neither
of these approaches will help you if you have used jdk1.6-only library
features and are targeting jre1.5, because the runtime will have no
support for them. The "-target" option (mostly) only affects language
features and the version number of the class files emitted by the compiler.
Here is an example, from the javac manual page for jdk1.6.0:
******
Cross-Compilation Example
Here we use javac to compile code that will run on a 1.4 VM.
% javac -target 1.4 -bootclasspath jdk1.4.2/lib/classes.zip \
-extdirs "" OldCode.java
The -target 1.4 option ensures that the generated class files will
be compatible with 1.4 VMs. By default, javac compiles for JDK 6.
The Java Platform JDK’s javac would also by default compile against
its own bootstrap classes, so we need to tell javac to compile
against JDK 1.4 bootstrap classes instead. We do this with -boot-
classpath and -extdirs. Failing to do this might allow compilation
against a Java Platform API that would not be present on a 1.4 VM
and would fail at runtime.
******

Signature
Ben Caradoc-Davies <ben@wintersun.org>
http://wintersun.org/
Stop Labor's plan to censor the internet:
http://efa.org.au/Issues/Censor/mandatoryblocking.html