Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Java on a Vista box reporting it is on XP?

I have stumbled across something truly puzzling regarding System.getProperty("os.name"). According to a Java bug on the matter and the Java 5 release notes (search for "os.name"), there was a bug in Java with early "longhorn" versions of Vista that should have been fixed in v5 release 10.

However on my Vista SP1 box - using both v5 release 15 and v6 release 6 - System.getProperty("os.name") returns "Windows XP". Further System.getProperty("os.version") returns "5.1". I cannot find anything relating to this issue via Google though. This makes me wonder whether it is something odd with my Vista setup. I have tried calling the GetVersionEx() API function from a test C program and it returns major version 6, minor 0 (as I'd expect for a Vista install).

Has anyone else encountered this problem, know of a fix or have any suggestions of how I might work around it without using JNI?

like image 701
David Arno Avatar asked Nov 07 '08 22:11

David Arno


1 Answers

It might be that Java runs in XP compatibility mode. In that case, Vista will fake the windows version number, making Java believe that it runs on XP. Check the compatibility tab of the executable.

like image 123
Martin v. Löwis Avatar answered Sep 20 '22 11:09

Martin v. Löwis