Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6819886
Votes 0
Synopsis System.getProperty("os.name") reports Vista on Windows 7
Category java:classes_lang
Reported Against
Release Fixed 7(b55), 6u14(b04) (Bug ID:2174558) , 5.0u19(b01) (Bug ID:2174566) , 1.4.2_21(b02) (Bug ID:2174567) , 6-open(b16) (Bug ID:2174585)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs 6642034 , 6714428 , 6820180 , 6821003 , 2174661 , 2174662 , 2174663 , 2174664
Submit Date 19-MAR-2009
Description
FULL PRODUCT VERSION :
java version "1.6.0_14-ea"
Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b03)
Java HotSpot(TM) Client VM (build 14.0-b12, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows 7 Ultimate x64, build 7057


A DESCRIPTION OF THE PROBLEM :
The name of the operating system is reported by System.getProperty ("os.version") as "Windows Vista" but it must be "Windows 7".

The same bug can be seen in recent builds of JDK 5.0 and JDK 6.0.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
OS = Windows 7
ACTUAL -
OS = Windows Vista

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class OSVersion {
    public static void main(String[] args) {
        System.out.println ("OS =" + System.getProperty ("os.name"));
    }
}
---------- END SOURCE ----------
Posted Date : 2009-03-19 23:20:23.0
Work Around
N/A
Evaluation
Need to examine minor version to distinguish Vista from Windows 7 (ie: 6.0 = Vista, 6.1 = Windows 7).
Posted Date : 2009-03-20 08:55:19.0
Comments
  
  Include a link with my name & email   

Submitted On 19-APR-2009
Bro2
Running Windows 7 Ultimate beta with 
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)

Test code:
---------- BEGIN SOURCE ----------
public class OSVersion2 {
	public static void main(String[] args) {
		System.out.println("OS: " + System.getProperty("os.name"));
		System.out.println("Version: " + System.getProperty("os.version"));
	}
}
---------- END SOURCE ----------

When running OSVersion2 through command prompt the output is:
OS: Windows Vista
Version: 6.1

When running the same class file through eclipse the output is:
OS: Windows XP
Version: 5.1

So it seems the os.version isn't reliable either. Great.



PLEASE NOTE: JDK6 is formerly known as Project Mustang