aspose file tools
The moose likes Beginning Java and the fly likes Executing External Command with a Twist Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Executing External Command with a Twist" Watch "Executing External Command with a Twist" New topic
Author

Executing External Command with a Twist

ManChun Lam
Greenhorn

Joined: May 04, 2008
Posts: 28
I have an external application that I want to call in my Java program. I have already successfully implemented the call. Now, the twist is that, if I hold "Ctrl" and execute this external program, a console (for debug) will pop up. I'm not aware of any command line switch that can do the same thing for this particular program. Is there a way, in Java, to simulate the action of "press and hold "Ctrl", then execute the external program"?

Thank you.
Sachin Joshi
Ranch Hand

Joined: Aug 06, 2008
Posts: 83

What is the way you are taking input from user? Is it a user interface like Swing/AWT or you are taking input from command line?

Capturing the key press can be done using event based programming in Swing/AWT you need to fire an event for a key press, and then check if the key pressed is control key.

And based on the type of key you can take different action.


Web Development Tips and Tutorials - By Sachin
ManChun Lam
Greenhorn

Joined: May 04, 2008
Posts: 28
What I'd like is to "hard-code" the "press Ctrl" event, so that I can just call the external program and a debug dialog will pop-up. Thank you.
ManChun Lam
Greenhorn

Joined: May 04, 2008
Posts: 28
I found the "Robot" class in the Java API that looks like what I want. I will give it a try.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Executing External Command with a Twist
 
Similar Threads
Rumtime
Interacting with Windows command prompt
execute exe from cmd line
Setting the classpath
Executing java Program.