0

We know that the Java compiler produces bytecode that is intermediate and platform-independent.

I'm running a 64-bit Windows Server 2008 R2 platform and i want to tell the Java Virtual Machine to compile the bytecode into 32 bit instead of 64 (its default behavior).

I'm doing this for compatibility issues with another 32 bit application.

Any help please!

P.S: It is preferable that i know how it is done through the JNI.

hiddenUser
  • 674
  • 1
  • 7
  • 19
  • This answer may be useful? http://stackoverflow.com/questions/9757456/java-native-interface-32-bit-dll-on-64-bit-system – Randall Hunt Dec 03 '13 at 21:06
  • Are you using a 32-bit JRE? – Elliott Frisch Dec 03 '13 at 21:34
  • The javac compiler that produces bytecode doesn't know 32 bit from 64 bit from furlong-per-fortnight. It's totally independent of machine word size. The JITC is, of course, machine dependent, but if you run a 32 bit JRE you should get 32-bit behaviors. – Hot Licks Dec 03 '13 at 22:37

2 Answers2

2

We know that the Java compiler produces bytecode that is intermediate and platform-independent.

Correct.

I'm running a 64-bit Windows Server 2008 R2 platform and i want to tell the Java Virtual Machine to compile the bytecode into 32 bit instead of 64 (its default behavior).

You've just contradicted yourself. You started out by saying, correctly, that the bytecode is platform-independent. Now you're saying, wrongly, that it is platform-specific, 32- or 64-bit. It isn't. It is platform-independent. You were right the first time. There is no such thing as 'compile the bytecode into 32 bit' or 'instead of 64 (its default behaviour)'.

It is preferable that i know how it is done through the JNI

Compilation isn't done through JNI.

user207421
  • 305,947
  • 44
  • 307
  • 483
0

ok here is the deal.

Byte code is a platform neutral way of saying "Java code is compiled to an executable, like we do in C/C++". Byte code is an intermediate format that is interpreted by the JVM to execute the instructions.

Now 32 bit or 64 bit is not the byte code, but the JVM or JRE or JDK that you use to generate that byte code or run it. I don't know if you know but actually its the JVM that gives us the illusion of a platform neutral capabilities of Java. Its your class file /jars that can be run anywhere, but you still need a platform dependent or conformant JVM or JRE to run your class files or jars in.

Nazgul
  • 1,892
  • 1
  • 11
  • 15