• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

to execute commands in linux through java

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
actually we have a project where we use Runtime class and its exec() method
to run dos commands on windows platform.but our requirements are now different .we now want either a dos command where we can open a file which contains a particular phrase or a keyword.

can we find such a dos COMMAND ?

OR

we can choose for linux platform.but the trouble is i dont know how to run commands in linux platform by using exec() method of Runtime class.

please help me soon.
 
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by amit bathla:
hi
actually we have a project where we use Runtime class and its exec() method
to run dos commands on windows platform.but our requirements are now different .we now want either a dos command where we can open a file which contains a particular phrase or a keyword.

can we find such a dos COMMAND ?

OR

we can choose for linux platform.but the trouble is i dont know how to run commands in linux platform by using exec() method of Runtime class.

please help me soon.




RunLinux.java
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you looking for something like the 'find' command for DOS?
I'm pretty sure there is one, perhaps called 'find' too or 'search'.

At least there are the UnxUtils here: UnxUtils which include grep.



These are native windows ports of the GNU Utils and don't need a cygwin or some emulator.

On Linux it would be in the example above:
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stefan Wagner:
Are you looking for something like the 'find' command for DOS?
I'm pretty sure there is one, perhaps called 'find' too or 'search'.

At least there are the UnxUtils here: UnxUtils which include grep.



These are native windows ports of the GNU Utils and don't need a cygwin or some emulator.

On Linux it would be in the example above:



There is a Unix find command and it bears about as much resemblance to the DOS find command as MS-Word does to Windows Notepad, funtionally speaking.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic