2

Let say i have a application which has a class A.java which only print some info.

So will my application work under:

[1] If i compile A with jdk1.7.x86 and run it with jre1.7.x64 on a 64 bit windows machine ?

[2] If i compile A with jdk1.7.x64 and run it with jre1.7.x86 on a 32 bit windows machine ?

[3] If i compile A with jdk1.7.x86 and run it with jre1.7.x86 on a 64 bit windows machine ?

[4] If i compile A with jdk1.7.x86 and run it with jre1.7.x64 on a 64 bit Linux machine ?

[5] If i compile A with jdk1.7.x64 and run it with jre1.7.x86 on a 32 bit Linux machine ?

[6] If i compile A with jdk1.7.x86 and run it with jre1.7.x86 on a 64 bit Linux machine ?

Bhuvan
  • 4,028
  • 6
  • 42
  • 84

2 Answers2

1

Yes. Oui. Si. Igen. Da. Jah. Yebo. Avanu. Ναι. Haan. Ha’an-ji. نعم. Dah. Of course. Not a problem. Without a doubt. No question. The promise of the Java Runtime Environment is Write Once, Run Anywhere.

Linux, Mac, Windows, VMS, Solaris, etc.

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249
1

The .class can run on any JVM which version is greater than the compile version in .class file.

eg:

If java file is compiled by jdk5, all JVM witch version is greater than 1.5 can run this class.

But if compile the java file like this:

javac -source 1.4 Your.java

The result class can run on JVM who's version is 1.4 or later.

lichengwu
  • 4,277
  • 6
  • 29
  • 42