From: Mike Schilling on
Lew wrote:
> ilya wrote:
>>> I use the method System.getProperty("os.name") to get the name of
>>> operation system. For the most computers it works fine. But on some
>>> computers it is installed windows 7, but this method shows that the
>>> operation system is windows vista. What can be the reason?
>>
>
> Could it be that the JVM simply asks the OS what it is, and that is
> what Windows tells it?
>
> Mike Schilling wrote:
>> Most likely that that version of Java doesn't know about Windows 7,
>> so it interprets any version number higher than XP's as Vista.
>>
>
> Are you claiming that the JVM hard-codes its knowledge of OSes rather
> than querying the OS itself?

I'm hypothesizing that there's a native Windows call that returns a version
number (in fact, I think I've read that), and the JVM translates that number
into a name .


From: Roedy Green on
On Mon, 3 May 2010 09:38:53 -0700, "Mike Schilling"
<mscottschilling(a)hotmail.com> wrote, quoted or indirectly quoted
someone who said :

>I'm hypothesizing that there's a native Windows call that returns a version
>number (in fact, I think I've read that), and the JVM translates that number
>into a name .

In Windows 7 you can find the OS name by looking in the registry
under:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\
ProductName="Windows 7 Home Premium"


Java prunes that back to: os.name = Windows 7
--
Roedy Green Canadian Mind Products
http://mindprod.com

What is the point of a surveillance camera with insufficient resolution to identify culprits?
From: Arne Vajhøj on
On 03-05-2010 12:15, Lew wrote:
> ilya wrote:
>>> I use the method System.getProperty("os.name") to get the name of
>>> operation system. For the most computers it works fine. But on some
>>> computers it is installed windows 7, but this method shows that the
>>> operation system is windows vista. What can be the reason?
>
> Could it be that the JVM simply asks the OS what it is, and that is
> what Windows tells it?

That can not be the explanation since Vista is version 6.0 and 7 is
version 6.1!

> Mike Schilling wrote:
>> Most likely that that version of Java doesn't know about Windows 7, so it
>> interprets any version number higher than XP's as Vista.
>
> Are you claiming that the JVM hard-codes its knowledge of OSes rather
> than querying the OS itself?

It has to query the OS.

But it can still do the version number to name translation based
on some hardcoded logic.

Arne