Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if a jar was compiled on a 64bit or 32bit system?

Tags:

java

I have a jar but I don't know if it is a .jar for a 64bit system or for a 32bit system. How to find that out?

EDIT: My .jar has native library dependency.

like image 865
Zhenya Avatar asked Sep 10 '13 08:09

Zhenya


People also ask

Can I run 32 bit and 64 bit Java on the same computer?

Yes, you can have both x64 bit and x32 bit Java installed. They won't create conflicts with with each other, as they're tied to the type of browser you're using.

What is the difference between 32 bit Java and 64 bit Java?

That's all about the difference between 32-bit and 64-bit JVM in Java. As you have seen, the key difference comes in how much memory you can allocate, while 32-bit JVM can just have 4G which is very less for modern, memory-intensive Java application, 64-bit JVM virtually gives you unlimited memory.

Do I need both 32 and 64 bit Java?

64 bit gives much better performance in most apps and it shouldn't matter if the launching program is 32 bit, it can still run the 64 bit java. @AthomSfere, minecraft for one, recommends using a 64 bit java runtime if you want to enable the highest graphics modes as the performance is too slow under 32 bit.


2 Answers

Java bytecode is java bytecode, it doesn't matter whether it was built with a 32-bit or 64-bit JDK and there is no way to figure this out.

I think it does not make any difference to have a jar compiled with 32-bit or 64-bit. It should be machine-independent; unless you have some native library dependency or the java code is directly being compiled to native code.

like image 177
Gyanendra Dwivedi Avatar answered Oct 21 '22 03:10

Gyanendra Dwivedi


A pure jar is not compiled to a particular architecture.

A 32 bit JVM will run the jar in 32 bit, likewise a 64 bt JVM will run the jar in 64 bit.

Of course, if your jar uses native libraries then the 'bitness' of these will have to match the JVM that you use to run the jar.

like image 45
Bathsheba Avatar answered Oct 21 '22 03:10

Bathsheba