如何检测 32 位 Java 是否安装在 x64 Windows 上,只查看文件系统和注册表? [英] How do I detect whether 32-bit Java is installed on x64 Windows, only looking at the filesystem and registry?

查看:14
本文介绍了如何检测 32 位 Java 是否安装在 x64 Windows 上,只查看文件系统和注册表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要确定特定系统是否安装了 32 位 Java.我正在执行一个远程查询,该查询只能让我访问文件系统和注册表,因此我无法尝试运行 java.exe,或运行任何 Java 代码.

I need to determine whether a particular system has 32-bit Java installed. I'm doing a remote query that only gives me access to the filesystem and registry, so I cannot attempt to run java.exe, or run any Java code.

我还想确保我检测到 IBM 和 Sun Java 以及任何其他发行版,这些发行版似乎将内容放在文件系统和注册表中的不同位置.

I also want to make sure I detect both IBM and Sun Java, as well as any other distributions, which seem to put things in different places on the filesystem and in the registry.

我想出的最好方法是检查 C:WindowsSysWOW64java.exe.这是测试 32 位 Java 是否存在的可靠方法,还是某些版本不会将 java.exe 放在该文件夹中?

The best I've come up with is to check for C:WindowsSysWOW64java.exe. Is this a reliable way to test for the presence of 32-bit Java, or are there certain versions that won't put java.exe in that folder?

更新:我仍在寻找更可靠的答案.需要说明的是,我无权访问命令提示符.此外,我想检测 Java,无论发布者是谁,安装了什么版本号,也不管用户选择在什么路径上安装它.

Update: I'm still looking for a more robust answer to this. Just to be clear, I don't have access to a command prompt. Also, I want to detect Java no matter who the publisher is, what version number is installed, and no matter what path the user chose to install it on.

C:WindowsSysWOW64java.exe 似乎符合这些要求,但我希望得到更了解的人的确认,即每个 Java 安装程序确实会将可执行文件放在那里.

C:WindowsSysWOW64java.exe seems to fit these requirements, but I'd love some confirmation from someone more knowledgeable that every Java installer will indeed put that executable there.

推荐答案

我在 Windows 上尝试了 Oracle 和 IBM Java 的 32 位和 64 位安装程序,并且存在 C:WindowsSysWOW64java.exe 似乎是确定 32 位 Java 可用的可靠方法.我还没有测试过这些安装程序的旧版本,但是对于最新版本的 Java,这至少看起来应该是一种可靠的测试方法.

I tried both the 32-bit and 64-bit installers of both Oracle and IBM Java on Windows, and the presence of C:WindowsSysWOW64java.exe seems to be a reliable way to determine that 32-bit Java is available. I haven't tested older versions of these installers, but this at least looks like it should be a reliable way to test, for the most recent versions of Java.

这篇关于如何检测 32 位 Java 是否安装在 x64 Windows 上,只查看文件系统和注册表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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