I have following problem:
我有以下问题:
I want to get the OS name via System.getProperty("os.name")
and System.getProperty("os.version")
on a Windows Vista machine.
我想在Windows Vista计算机上通过System.getProperty(“os.name”)和System.getProperty(“os.version”)获取操作系统名称。
I have checked the compatibility mode settings of the java executables.
我检查了java可执行文件的兼容模式设置。
Java reports following:
Java报告如下:
C:\Program Files\Java\jre6\bin\java.exe - no compatibility mode --> Windows Vista / 6.0 (OK)
C:\Program Files\Java\jre6\bin\java.exe - compatibility mode "Windows XP" --> Windows XP / 5.1 (OK)
C:\Program Files\Java\jre6\bin\javaw.exe - no compatibility mode --> Windows XP / 5.1 (WRONG)
C:\Program Files\Java\jre6\bin\javaw.exe - compatibility mode "Windows XP" --> Windows XP / 5.1 (OK)
C:\ Program Files \ Java \ jre6 \ bin \ java.exe - 无兼容模式 - > Windows Vista / 6.0(OK)C:\ Program Files \ Java \ jre6 \ bin \ java.exe - 兼容模式“Windows XP “ - > Windows XP / 5.1(确定)C:\ Program Files \ Java \ jre6 \ bin \ javaw.exe - 无兼容模式 - > Windows XP / 5.1(错误)C:\ Program Files \ Java \ jre6 \ bin \ javaw.exe - 兼容模式“Windows XP” - > Windows XP / 5.1(OK)
i'm using java 1.6.0_34 (x86) on a 32 bit vista.
我在32位Vista上使用java 1.6.0_34(x86)。
does anybody know what the reason for this could be?
有谁知道这可能是什么原因?
1 个解决方案
#1
0
Most likely you're running java in compatability mode. This might be because you've decided to do so manually (e.g. by right clicking java > properties > compatability mode), or because Windows has decided to lie to Java for app-compat reasons.
很可能你在兼容模式下运行java。这可能是因为您已决定手动执行此操作(例如,通过右键单击java>属性>兼容模式),或者因为Windows因app-compat原因决定欺骗Java。
The app-compat version lie is often given to programs that don't behave well on newer versions of Windows due to broken logic, e.g:
app-compat版本谎言通常用于由于逻辑损坏而在较新版本的Windows上表现不佳的程序,例如:
if(Windows.Version != WindowsXP)
abort("Windows 2000 is too old!");
This logic fails on Windows Vista, stopping java from working. Hence Windows lies to it to keep it working. When it later says "what version am I" as part of the System.getProperty("os.name") call it therefore gets it wrong.
这个逻辑在Windows Vista上失败,阻止java工作。因此,Windows要求它保持工作。当它后来说“我是什么版本”作为System.getProperty(“os.name”)调用的一部分时,因此它会出错。
To fix this, check that you have the latest version of Java installed.
要解决此问题,请检查您是否安装了最新版本的Java。
#1
0
Most likely you're running java in compatability mode. This might be because you've decided to do so manually (e.g. by right clicking java > properties > compatability mode), or because Windows has decided to lie to Java for app-compat reasons.
很可能你在兼容模式下运行java。这可能是因为您已决定手动执行此操作(例如,通过右键单击java>属性>兼容模式),或者因为Windows因app-compat原因决定欺骗Java。
The app-compat version lie is often given to programs that don't behave well on newer versions of Windows due to broken logic, e.g:
app-compat版本谎言通常用于由于逻辑损坏而在较新版本的Windows上表现不佳的程序,例如:
if(Windows.Version != WindowsXP)
abort("Windows 2000 is too old!");
This logic fails on Windows Vista, stopping java from working. Hence Windows lies to it to keep it working. When it later says "what version am I" as part of the System.getProperty("os.name") call it therefore gets it wrong.
这个逻辑在Windows Vista上失败,阻止java工作。因此,Windows要求它保持工作。当它后来说“我是什么版本”作为System.getProperty(“os.name”)调用的一部分时,因此它会出错。
To fix this, check that you have the latest version of Java installed.
要解决此问题,请检查您是否安装了最新版本的Java。