Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine, in Java, whether another process or executable is 32-bit or 64-bit

Does Java has any API to call that can know whether a process or an .exe file is 32-bit or 64-bits? - not the JVM in which your code is running

like image 204
Mango Avatar asked Dec 09 '22 13:12

Mango


1 Answers

There is no standard Java API for determining whether an external process is 32 or 64 bit.

If you wanted to do this, you would either need to use native code, or call an external utility to do this. The solution is likely to be platform specific in both cases. Here are some possible (platform specific) leads:

  • (OSX) Is there a way to check if process is 64 bit or 32 bit?

  • (Linux) https://unix.stackexchange.com/questions/12862/how-to-tell-if-a-running-program-is-64-bit-in-linux

  • (Windows) http://blogs.technet.com/b/windowshpc/archive/2009/03/27/how-to-tell-if-a-exe-file-is-a-32-bit-or-64-bit-application-using-dumpbin.aspx

(Note that in the Windows cases, the solution involves testing the ".exe" file rather than the running process, so you need to be able to determine the relevant ".exe" file first ...)

like image 120
Stephen C Avatar answered Dec 29 '22 01:12

Stephen C