Re: Can Java detect host OS?
From: Bill Scott (grumpyBill_at_yahoo.com)
Date: 12/08/03
- Next message: David: "Making some money out of web services with referral schemes?"
- Previous message: Josiah: "Can Java detect host OS?"
- In reply to: Josiah: "Can Java detect host OS?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 8 Dec 2003 11:19:03 -0800
Check-out the System property (i.e. "System.getProperty(...")) called
"os.name". The only trick is making sure you know the possible set of
Strings returned. Linux seems to usually return "Linux", but Windows
can return a few Strings depending on the version of the OS and JVM.
You'll have to do some experimentation to determine the correct set to
compare-against.
-Bill
josiahdykstra@hotmail.com (Josiah) wrote in message news:<dbde4b9b.0312080709.6bf41723@posting.google.com>...
> I can't seem to find any documentation as to whether or not Java can
> detect the host operating system a program is running on. For
> instance, if I only want some block of code to run if the program is
> running on Windows (or Linux), can I detect that?
>
> Thanks!
- Next message: David: "Making some money out of web services with referral schemes?"
- Previous message: Josiah: "Can Java detect host OS?"
- In reply to: Josiah: "Can Java detect host OS?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|