get name of operation system

I

ilya

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?
 
M

Mike Schilling

ilya said:
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?

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.
 
L

Lew

Could it be that the JVM simply asks the OS what it is, and that is
what Windows tells it?

Mike said:
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?
 
M

Mike Schilling

Lew said:
Could it be that the JVM simply asks the OS what it is, and that is
what Windows tells it?



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 .
 
R

Roedy Green

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
 
A

Arne Vajhøj

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!
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top