Upgrading to Java 6- will it run on 5?

Discussion in 'Java' started by stevecanfield@yahoo.com, Feb 2, 2007.

  1. Guest

    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
     
    , Feb 2, 2007
    #1
    1. Advertising

  2. Daniel Pitts Guest

    On Feb 2, 9:51 am, 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.
     
    Daniel Pitts, Feb 2, 2007
    #2
    1. Advertising

  3. On Feb 3, 4:51 am, 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.
     
    Andrew Thompson, Feb 2, 2007
    #3
  4. Guest

    On Feb 2, 10:02 am, "Andrew Thompson" <> wrote:
    > On Feb 3, 4:51 am, 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.


    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
     
    , Feb 2, 2007
    #4
  5. On Feb 3, 5:21 am, wrote:
    > On Feb 2, 10:02 am, "Andrew Thompson" <> wrote:

    ...
    > > On Feb 3, 4:51 am, 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.
     
    Andrew Thompson, Feb 2, 2007
    #5
  6. Pete C Guest

    On 2 Feb., 18:51, 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/prod...nt_presse/vnu/StarOffice0506/avquk_so0506.cfm
     
    Pete C, Feb 3, 2007
    #6
  7. On Feb 3, 1:44 pm, "Pete C" <> wrote:
    > On 2 Feb., 18:51, 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.
     
    Andrew Thompson, Feb 3, 2007
    #7
  8. Pete C wrote:
    > 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.

    ******

    --
    Ben Caradoc-Davies <>
    http://wintersun.org/
    Stop Labor's plan to censor the internet:
    http://efa.org.au/Issues/Censor/mandatoryblocking.html
     
    Ben Caradoc-Davies, Feb 3, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Corrie Taljaard

    Upgrading VB6 to C#

    Corrie Taljaard, Jul 3, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    17,367
    migr8tor
    Jun 25, 2009
  2. Replies:
    2
    Views:
    1,972
    migr8tor
    Jun 25, 2009
  3. Sesha

    Upgrading to .NET framework v1.1

    Sesha, Jul 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,373
    Jay B. Harlow [MVP - Outlook]
    Jul 23, 2003
  4. Nitin Singh

    Upgrading to .NET 2.0

    Nitin Singh, Jun 3, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    493
    Phil Wright
    Jun 12, 2005
  5. Replies:
    1
    Views:
    386
Loading...

Share This Page