.class with JDK1.2 --> run with JRE1.4 ???

Discussion in 'Java' started by qazmlp, Jul 14, 2004.

  1. qazmlp

    qazmlp Guest

    Assume that, I have generated a .class file after compiling a java
    program with the JDK1.2.
    Is it 100% guaranteed always that, this program will run without any
    problems under the JRE1.4 environment? If yes/no, why?
     
    qazmlp, Jul 14, 2004
    #1
    1. Advertising

  2. qazmlp

    kaeli Guest

    In article <>, qazmlp1209
    @rediffmail.com enlightened us with...
    > Assume that, I have generated a .class file after compiling a java
    > program with the JDK1.2.
    > Is it 100% guaranteed always that, this program will run without any
    > problems under the JRE1.4 environment? If yes/no, why?
    >


    No.
    Because tools like this exist.
    http://javaadvisor.com/doc/13054

    --
    --
    ~kaeli~
    A lot of money is tainted - It taint yours and it taint mine.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Jul 14, 2004
    #2
    1. Advertising

  3. qazmlp wrote:
    > Assume that, I have generated a .class file after compiling a java
    > program with the JDK1.2.
    > Is it 100% guaranteed always that, this program will run without any
    > problems under the JRE1.4 environment? If yes/no, why?


    It depends what you mean by that. The class file format has not changed
    since Java 1.0. The VMs for 1.4 will correctly run bytecode produced by
    the JDK 1.2 compiler. Compatibility issues arise (a bit) when you start
    looking at the platform library. As far as I am aware, nothing from the
    1.2 library has been removed from 1.4, although some methods are now
    deprecated.

    You may run into trouble if your 1.2 classes extend classes from the
    platform library or implement interfaces from the platform library.
    Where a new abstract method has been added to a class or a method has
    been added to an interface since 1.2, your concrete classes may suddenly
    become abstract when run against the 1.4 library. I am not aware
    offhand of any classes to which this would apply, but there may be some.
    There certainly are some interfaces to which it applies, but none I am
    aware of that are commonly implemented by user code. I can imagine some
    cases in which interaction of the 1.4 classes with your code would
    produce unexpected results because of new concrete methods added to the
    platform classes (and unwittingly inherited by your classes), but I
    think such cases are generally unlikely.

    Your best bet is to actually test. If you have a unit test suite then
    that's easy. If not, then maybe now is the time to write one. If you
    don't want to write one then you can still test manually (and you can
    look forward to future rounds of manual testing, too).


    John Bollinger
     
    John C. Bollinger, Jul 14, 2004
    #3
  4. qazmlp

    ohaya Guest

    "John C. Bollinger" wrote:
    >
    > qazmlp wrote:
    > > Assume that, I have generated a .class file after compiling a java
    > > program with the JDK1.2.
    > > Is it 100% guaranteed always that, this program will run without any
    > > problems under the JRE1.4 environment? If yes/no, why?

    >
    > It depends what you mean by that. The class file format has not changed
    > since Java 1.0. The VMs for 1.4 will correctly run bytecode produced by
    > the JDK 1.2 compiler. Compatibility issues arise (a bit) when you start
    > looking at the platform library. As far as I am aware, nothing from the
    > 1.2 library has been removed from 1.4, although some methods are now
    > deprecated.
    >
    > You may run into trouble if your 1.2 classes extend classes from the
    > platform library or implement interfaces from the platform library.
    > Where a new abstract method has been added to a class or a method has
    > been added to an interface since 1.2, your concrete classes may suddenly
    > become abstract when run against the 1.4 library. I am not aware
    > offhand of any classes to which this would apply, but there may be some.
    > There certainly are some interfaces to which it applies, but none I am
    > aware of that are commonly implemented by user code. I can imagine some
    > cases in which interaction of the 1.4 classes with your code would
    > produce unexpected results because of new concrete methods added to the
    > platform classes (and unwittingly inherited by your classes), but I
    > think such cases are generally unlikely.
    >
    > Your best bet is to actually test. If you have a unit test suite then
    > that's easy. If not, then maybe now is the time to write one. If you
    > don't want to write one then you can still test manually (and you can
    > look forward to future rounds of manual testing, too).
    >



    John,

    My apologies for dropping in on this thread, but a couple of weeks ago,
    I had posted some questions related to serialized objects (in files).
    In general, wouldn't something like that be another potential problem
    area, e.g., if the format of the serialized data has changed between
    versions (I don't think it did between 1.2 and 1.4)?

    Jim
     
    ohaya, Jul 15, 2004
    #4
  5. ohaya wrote:
    > My apologies for dropping in on this thread, but a couple of weeks ago,
    > I had posted some questions related to serialized objects (in files).
    > In general, wouldn't something like that be another potential problem
    > area, e.g., if the format of the serialized data has changed between
    > versions (I don't think it did between 1.2 and 1.4)?


    There is a potential for difficulty here if serialized objects are used
    for persistent storage. Depending on the classes involved it might or
    might not work. Serialization is a terrible approach for persistent
    object storage, however, in part for that very reason. There is also a
    potential for problems if serialization is used for object transport,
    for instance in an RMI application. The Serialization subsystem has
    mechanisms to address that, but it is possible (if unlikely) to run into
    unresolvable difficulties when one side of the link is using a different
    version of the platform library than the other side.


    John Bollinger
     
    John C. Bollinger, Jul 15, 2004
    #5
    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. Michal M
    Replies:
    7
    Views:
    812
    Andrew Thompson
    Aug 2, 2005
  2. U. George
    Replies:
    4
    Views:
    866
    U. George
    Aug 11, 2005
  3. Guapo
    Replies:
    7
    Views:
    2,183
    Jon Martin Solaas
    Mar 13, 2006
  4. Replies:
    3
    Views:
    5,218
    Bjorn Abelli
    Mar 30, 2006
  5. sujit
    Replies:
    1
    Views:
    948
    Arne Vajhøj
    Jan 5, 2011
Loading...

Share This Page