Results 1 to 5 of 5
  1. #1
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default code executing on windows/unix box

    Hi,
    In my java program is it possible to find out if the operating system on which its running is windows or unix box. Based upon this I need to set the value of a parameter.

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I'm sure you can find the operating system being run with the System class, check the API for more details.

  3. #3
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    Java Code:
    String osName = System.getProperty("os.name");
    ...will get you a String value defining the operating system.

  4. #4
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default

    Thanks doWhile

  5. #5
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    If you are done with the thread, please mark it thread with the thread tools at the top of this page.

Similar Threads

  1. problems with executing unix commands
    By shanky in forum Advanced Java
    Replies: 1
    Last Post: 02-18-2010, 05:36 AM
  2. Access Windows xp from Unix machine
    By mchhapolia in forum Advanced Java
    Replies: 2
    Last Post: 04-15-2009, 02:04 AM
  3. Communicate between Windows and UNIX
    By nwboy74 in forum Networking
    Replies: 10
    Last Post: 11-04-2008, 08:53 PM
  4. Replies: 0
    Last Post: 06-20-2008, 09:02 AM
  5. how to run java app on windows in a cron like on unix
    By rockie12 in forum Advanced Java
    Replies: 7
    Last Post: 05-23-2008, 01:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •