- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
在使用 NSIS 安装程序进行安装期间,我需要检查系统上安装了哪个 JRE(32 位与 64 位)。我已经知道我可以检查系统属性“sun.arch.data.model
”,但这是特定于 Sun 的。我想知道是否有一个标准的解决方案。
最佳答案
可以使用“os.arch”属性检索正在使用的 JVM 架构:
System.getProperty("os.arch");
“os”部分似乎有点用词不当,或者最初的设计者可能没有预料到 JVM 会在他们不是为之编写的架构上运行。返回值似乎是 inconsistent .
NetBeans 安装程序团队是 tackling the issue JVM 与 OS 架构的对比。引用:
x64 bit : Java and System
Tracked as the Issue 143434.
Currently we using x64 bit of JVM to determine if system (and thus Platform.getHardwareArch()) is 64-bit or not. This is definitely wrong since it is possible to run 32bit JVM on 64bit system. We should find a solution to check OS real 64-bitness in case of running on 32-bit JVM.
- for Windows it can be done using WindowsRegistry.IsWow64Process()
- for Linux - by checking 'uname -m/-p' == x86_64
- for Solaris it can be done using e.g. 'isainfo -b'
- for Mac OSX it can't be done using uname arguments, probably it can be solved by creating of 64-bit binary and executing on the platform... (unfortunately, this does not work:( I've created binary only with x86_64 and ppc64 arch and it was successfully executed on Tiger..)
- for Generic Unix support - it is not clear as well... likely checking for the same 'uname -m/-p' / 'getconf LONG_BIT' and comparing it with some possible 64-bit values (x86_64, x64, amd64, ia64).
来自不同 JVM 的示例属性,均在 64 位 Ubuntu 8.0.4 上运行:
32 位 IBM 1.5:
java.vendor=IBM Corporation
java.vendor.url=http://www.ibm.com/
java.version=1.5.0
java.vm.info=J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20061001 (JIT enabled)
J9VM - 20060915_08260_lHdSMR
JIT - 20060908_1811_r8
GC - 20060906_AA
java.vm.name=IBM J9 VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=IBM Corporation
java.vm.version=2.3
os.arch=x86
os.name=Linux
os.version=2.6.24-23-generic
sun.arch.data.model=32
64 位 Sun 1.6:
java.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
java.version=1.6.0_05
java.vm.info=mixed mode
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=Sun Microsystems Inc.
java.vm.version=10.0-b19
os.arch=amd64
os.name=Linux
os.version=2.6.24-23-generic
sun.arch.data.model=64
64 位 GNU 1.5:
java.vendor=Free Software Foundation, Inc.
java.vendor.url=http://gcc.gnu.org/java/
java.version=1.5.0
java.vm.info=GNU libgcj 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
java.vm.name=GNU libgcj
java.vm.specification.name=Java(tm) Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=Free Software Foundation, Inc.
java.vm.version=4.2.4 (Ubuntu 4.2.4-1ubuntu3)
os.arch=x86_64
os.name=Linux
os.version=2.6.24-23-generic
(GNU 版本不报告“sun.arch.data.model”属性;可能其他 JVM 也不报告。)
关于64-bit - 如何检测安装了哪种 JRE——32 位与 64 位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/807263/
是否可以在没有 bit.dev 帐户的情况下将 bit 设置为本地服务器以进行内部处理? 我知道您可能没有相同的功能 -- bit's FAQ page说“与 Bit CLI 不同,bit.dev 服
我是一名计算机科学学生,学习如何用 C 语言编程。我有 3 个文件和一个 Makefile。我有 logic.c logic.h main.c logic.c 的顶部是: #include "log
我有一个特殊的无符号长整型(32 位),我需要一点一点地转换它的字节序 - 我的长整型表示将多个内容混合在一起形成一个二进制文件。 我该怎么做? 最佳答案 字节顺序是一个字级概念,其中字节要么以最高有
我有许多 iOS Xcode 项目都使用同一个子项目。这个子项目构建一个静态库,然后链接到主项目。到目前为止,这个子项目和所有主项目都是 32 位的。 我想构建一个支持 64 位的新项目,因此将架构设
我创建了一个使用 SIMD 执行 64 位 * 64 位到 128 位的函数。目前我已经使用 SSE2(实际上是 SSE4.1)实现了它。这意味着它同时处理两个 64b*64b 到 128b 的产品。
想知道是否有人对我如何对二进制数执行以下操作有一些了解: 转换 01+0 -> 10+1 (+ as in regular expressions, one or more) 01 ->
代码如下: unsigned int v; // word value to compute the parity of v ^= v >> 16; v ^= v >> 8; v ^= v >> 4
我正在尝试在(测试版)Trackmania 2 游戏中制作脚本。(这是 JavaScript、HTML、C 和...其他我在最糟糕的噩梦中无法想象的东西的丑陋混合)。 脚本引擎似乎不知道“and”或“
这个问题在这里已经有了答案: How do AX, AH, AL map onto EAX? (6 个回答) 去年关闭。 所以,假设我正在使用寄存器 %rax和 %rdi . 作为一个基本的例子,让我
我是编程新手,来自非CS背景(没有正式学位)。我主要使用C#编写Winforms。 我对32位和64位感到困惑...。我的意思是,听说过32位OS,32位处理器以及基于程序的最大内存。它如何影响程序的
“清除整数的第 6 位”的最佳方法是什么? 而且,您的解决方案平台是否独立? (32 位或 64 位整数等)。如果没有,您能否提供一个独立于平台的解决方案? 更新: 我们不知道该位在给出时是已设置还是
我刚刚在交错一些 float 时发现了一些狡猾的问题。我简化了问题并尝试了一些测试 #include #include std::vector v; // global instance unio
我不想用这个来骚扰你,但我在互联网上的任何地方都找不到对“位填充”到底是什么的详细解释,也没有找到与位填充相关的线程的任何答案在 StackOverflow 上。 我还在 ISO 9899-1990
我有点卡住了,因为我找不到任何涵盖缓存“数据”部分的内容,我用谷歌搜索的所有内容都涉及 99.9% 的缓存寻址。我被问到的问题是这样措辞的 Contrast the difference betwee
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
是否有人通过运行/附加到 64 位应用程序成功调试 64 位 dll?我有应用程序和 dll 的 Delphi 代码。我可以调试 32 位和 64 位应用程序。我还可以通过使用 Run -> Para
我有一些使用 native 组件的库,这些库是使用 NDK 为 32 位 Arm 架构构建的。 现在我们在现代设备上有 64 位处理器,所以我想知道这些库是否可以工作。在我的情况下,我没有本地库的源代
这是我上一个问题的延伸 - How to securely and efficiently store SSN in a database? 这个想法是,我想要安全地散列社会安全号码,然后插入到列中,
我很尴尬地说,我的数学技能很弱,而且我是一名自豪的计算机科学专业。我正在上课,这真是太令人难以承受了。这是我家庭作业的一部分,但是,在理解这一部分之前我无法继续。我类的每个人都在努力编写某种方法来完成
在 InnoSetup 中我运行这段代码: J32 := ShellExec('', 'java', '-d32 -version', '', SW_HIDE, ewWaitUntilTerminat
我是一名优秀的程序员,十分优秀!