aspose file tools
The moose likes Java in General and the fly likes launching a non java APP from a java APP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "launching a non java APP from a java APP" Watch "launching a non java APP from a java APP" New topic
Author

launching a non java APP from a java APP

Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
hi
I would like to write a program thta will launch another non-java program and then get a handle on that program so my program can push buttons on the second program
is this possible in JAVA where do i start
what java package supports this/
thanx
Fred
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
This might be possible with some native calls. I'm not sure though. You might want to look at some information on the Java Native Interface (I think that's what it's called).
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I don't know. Once you lauch the second program, when IT has focus your program is out of control.
What is it that you REALLY want to accomplish. Perhaps some more detail.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
what i am trying to do is automate a program that my company uses
we have a program that once started up we push a series of buttons to get desired results.... we then take those results and write them to a file and do the same process again . . someone actually does this the whole day so I would like to write a program so that i can control the buttons
Thank You
Fred
Suraj K
Greenhorn

Joined: Jul 02, 2001
Posts: 7
if you want to launch a non-java app from windows use this:
Runtime().getRuntime().exec("non-java.exe");
thats all.. but i think u will need to enclose it in an exception handler.
hope that helped.
Kaspar Dahlqvist
Ranch Hand

Joined: Jun 18, 2001
Posts: 128
Hi! The exec() method in Runtime returns a Process object, which can be used to perform IO on it. I think it should be possible to control the subprocess with the methods of this object. But I don't know how...
Chris Camisa
Greenhorn

Joined: Jun 20, 2001
Posts: 4
I would like to know how to do this as well...
I have wanted to control finding files on peer to peer networks like Napster and GNUtella (Limewire) for a long time.
I don't particularly like their interface and I want to change it...

If I could write code that allowed me to read textfields from within those programs and then have it push buttons for me and or fill in textfields then I could write a sorting method to act as AI for my connection to the network.
BTW, wouldn't Java need to open the program's window originally so that it didn't catch a security violation of somesort...?
--==]Chris Camisa[==--
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
Thank you all for your help -
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
There is a Robot class (that I have not played with) that might offer some opportunity for setting up scripts for "keystrokes" to help you.
Zkr Ryz
Ranch Hand

Joined: Jan 04, 2001
Posts: 187
Im trying this code on my Windows "powered" pc
and nothig happens

What else should I do ?
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
I tried your code - take out the word start - and it works fine
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
Originally posted by Cindy Glass:
There is a Robot class (that I have not played with) that might offer some opportunity for setting up scripts for "keystrokes" to help you.

where can i find this robot class - what package is it in?
thanx
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
In 1.3 java.awt.Robot
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
thanx
Ashish Jaiman
Ranch Hand

Joined: May 01, 2001
Posts: 47
This prog launches notepad
public class RuntimeDemo
{
public static void main(String[] args)
{
Runtime r= Runtime.getRuntime();
Process p = null;
try
{
p = r.exec("notepad");
}
catch (Exception ex)
{
}
}
}


-AJ<br />Sun Certified Java Programmer<br />Microsoft Certified Software Developer
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: launching a non java APP from a java APP
 
Similar Threads
Capturing Screen
Interacting with application from Java.
Annoying DOS window
Verbose Logging in Java
Setting JMX Options