如何用Java确定另一个进程或可执行文件是32位还是64位 [英] How to determine, in Java, whether another process or executable is 32-bit or 64-bit

查看:120
本文介绍了如何用Java确定另一个进程或可执行文件是32位还是64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java是否有任何可调用的API可以知道进程或.exe文件是32位还是64位?
-不是在其中运行代码的JVM

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

推荐答案

没有用于确定是否 external 进程是32或64位。

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-在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

(请注意,在Windows情况下,该解决方案涉及测试 .exe文件而不是正在运行的进程,因此您需要o能够先确定相关的 .exe文件...)

(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 ...)

这篇关于如何用Java确定另一个进程或可执行文件是32位还是64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆