Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

linux or windows

 
marys joseph
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
 
Jason Fox
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • 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.
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
I am using ping.exe if os is windows if it is linux I call ping or traceroute.

thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic