如何在 Linux 上检查 java 位版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4636700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check java bit version on Linux?
提问by u123
Possible Duplicate:
installed jvm is 64 bit or 32 bit
可能重复:
安装的 jvm 是 64 位或 32 位
How do I check which bit version of Java is installed on my linux machine? When I type:
如何检查我的 linux 机器上安装了哪个位版本的 Java?当我输入:
java -version
I get:
我得到:
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode)
Is that 32bit or 64bit?
那是32位还是64位?
采纳答案by sjr
Run java
with -d64
or -d32
specified, it will give you an error message if it doesn't support 64-bit or 32-bit respectively. Your JVM may support both.
java
使用-d64
或-d32
指定运行,如果它分别不支持 64 位或 32 位,它将给你一个错误信息。您的 JVM 可能同时支持两者。
回答by tomeduarte
Go to this JVM online testand run it.
转到这个JVM 在线测试并运行它。
Then check the architecture displayed: x86_64 means you have the 64bit version installed, otherwise it's 32bit.
然后检查显示的架构:x86_64 表示您安装了 64 位版本,否则为 32 位。
回答by Lukasz
Why don't you examine System.getProperty("os.arch")
value in your code?
为什么不检查System.getProperty("os.arch")
代码中的值?
回答by shellholic
Works for every binary, not only java:
适用于每个二进制文件,不仅适用于 java:
file - < $(which java) # heavyly bashic
cat `which java` | file - # universal