Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing External Command with a Twist

 
ManChun Lam
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ManChun Lam
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the "Robot" class in the Java API that looks like what I want. I will give it a try.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic