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

查看:31
本文介绍了在 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

推荐答案

没有用于确定外部进程是 32 位还是 64 位的标准 Java API.

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:

(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

(注意,在Windows情况下,解决方案涉及测试.exe"文件而不是运行进程,因此您需要能够首先确定相关的.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天全站免登陆