0

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.

I have checked the compatibility mode settings of the java executables.

Java reports following:

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)

i'm using java 1.6.0_34 (x86) on a 32 bit vista.

does anybody know what the reason for this could be?

dominik
  • 151
  • 1
  • 2
  • 13

1 Answers1

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.

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:

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.

To fix this, check that you have the latest version of Java installed.

SecurityMatt
  • 6,593
  • 1
  • 22
  • 28