• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass command to CMD Line from Java  RSS feed

 
preetam verma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working in project and need to fire a command to command line of window and get output and need to represent in graphical form.

My question is:

1 How can I fire commnd to command line and get output
2 What is best way to represnet these information in graphical form
[ September 02, 2008: Message edited by: preetam verma ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on Servlets.

For more information, please read this.

This post has been moved to a more appropriate forum.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the Process and Runtime classes
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or ignore Runtime and look at ProcessBuilder instead.
 
Ragav Baskaran
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use this static exec(String command) method of RunTime class.

This method returns a Process object, which can be used to control the process, may be if needed you can even destroy/kill the process.

However there are some limitations in using this. For more info
see here
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Processes, make sure to do a search through the Ranch for similar threads; there are several points you need to check, and finding the classic paper by Michael Daconta will also help.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean When Runtime.exec() won't? I've bookmarked that article since it is such a great source of information.
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:
You mean When Runtime.exec() won't? I've bookmarked that article since it is such a great source of information.
Yes, but I thought I'd let them look for it themselves.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!