Re: Can Java detect host OS?

From: Bill Scott (grumpyBill_at_yahoo.com)
Date: 12/08/03


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!



Relevant Pages

  • Re: Connecting to PIX using Linux
    ... >I normally use a terminal emulator on windows to connect to a PIX501 ... >I am now using a linux box to do the same. ... kermit or minicom should do the trick. ...
    (comp.dcom.sys.cisco)
  • Re: VFP - Linux?
    ... The main trick is "will my current application that works well in Windows ... Remember that Linux knows nothing about Activex, ... Anyone that knows any other options to use a Foxpro exe com ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Future of IT in Lebanon
    ... working knowledge of Indian programmers DNA, nor of their intuitive Java ... > So Longhorn is not an experiment and Linux is an experiment? ... another chapter in the Windows story, and the Microsoft marketing machine is ... > application opens, Check the about, it says Microsoft Visual Basic 6.3. ...
    (soc.culture.lebanon)
  • FTP DOWNLOAD! More than 6500 CRACKED SOFTWARE(CAD,CAE,CAM,ED
    ... Autodesk Architectural Desktop 2005 ... DASSAULT SYSTEMES CAA ENOVIA LCA V5R13 ... ALTAIR.OPTISTRUCT V5.1 for LINUX ... ANSYS V8.0 FOR WINDOWS ...
    (microsoft.public.dotnet.framework.adonet)
  • Linux for Senior Citizens
    ... Linux for Senior Citizens ... For such people, I believe, Windows really is a better option: ... The kernel manages all the hardware and also looks after all running ...
    (uk.people.silversurfers)