Sachin Thapa
Sachin Thapa

Reputation: 3709

Can a Java Object created by higher Java version run in a lower Java version

Here is what I mean to ask:

  1. Component A is publishing objects to Component B using MQ Server
  2. Component A is compiled and runs on Java 6
  3. Component B is compiled and runs on Java 4

What will happen ?

I dont have enough infrastructure to test this out.

Upvotes: 0

Views: 90

Answers (2)

Peter Lawrey
Peter Lawrey

Reputation: 533432

In your case Component A must write something which Component B can understand. Nothing else matters.

You can't actually pass objects over a messaging system. All you can do is to serialize the data into bytes at one end and deserialize the data at the other. This means that classes at one end can be completely different to those at the other (not just different versions, but even different languages). The problem is the wire protocol needs to be compatible.

Upvotes: 0

sandymatt
sandymatt

Reputation: 5612

You will probably get an unsupported major / minor exception. Have a look at this post that talks about it:

How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

Basically, you should compile all of your source to run on a particular version of Java.

Upvotes: 3

Related Questions