• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

linux or windows

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I need to check if the machine is in linux or windows how can I check it?

also as we call .exe files for windows how can we do that in linux

thanks
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can query System.getProperties to find out, for System.getProperty(String), I'm not what string returns the OS, but it shouldn't be too difficult to find. As far as executing something in Linux, it works a little differently than on Windows. Linux relies on permissions, rather than on file extensions to tell it which apps are executable. You will need to set the permissions to executable using the chmod command.
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Not exactly advanced IMHO, hence I can answer! You run an executable under Linux in basically the same way as under Windows. As Jason says, the file must have execute permission.

Jules
 
marys joseph
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks all for replying. I need to do "ping" and " traceroute" using java. I am opening a ".exe" to do. that's why I need to know the system prop so that the correct cmd is excuted.

thanks again,

I will try to find system.getproperty(string)
 
Jason Fox
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless you are using an emulator, WINE, or something similiar, a windows executable shouldn't run under Linux. However, traceroute and ping are both programs included in most Linux distros. If they are in your path, simply type traceroute <options> or ping<options> and it should work. If not, you may have to go digging to find them.
 
marys joseph
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using ping.exe if os is windows if it is linux I call ping or traceroute.

thanks,
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic