Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Executing External Command with a Twist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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
Ranch Hand

Joined: May 04, 2008
Posts: 32
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
Ranch Hand

Joined: May 04, 2008
Posts: 32
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
Ranch Hand

Joined: May 04, 2008
Posts: 32
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://aspose.com/file-tools
 
subject: Executing External Command with a Twist
 
Similar Threads
Setting the classpath
Executing java Program.
Interacting with Windows command prompt
execute exe from cmd line
Rumtime