• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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: 26014
186
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.
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic