Exec

F

Francois Lionet

Hi all,

First of all, I must thank you : I have asked 5 questions in this forum, and
each time I had a good answer that really helped me. So thank you!

My new question :
I want to launch an external program from my application (currently under
Windows, but I want it to work as well on a Mac and Linux). I have the
pathname to the application (as a File object). But I can't find the method
to actually launch the application. I have searched in the system object,
and the file object. No success.
Can anyone tell me how to do this?

Thanks in advance.

Francois
 
A

Andreas Wollschlaeger

Francois said:
Hi all,

First of all, I must thank you : I have asked 5 questions in this forum, and
each time I had a good answer that really helped me. So thank you!

My new question :
I want to launch an external program from my application (currently under
Windows, but I want it to work as well on a Mac and Linux). I have the
pathname to the application (as a File object). But I can't find the method
to actually launch the application. I have searched in the system object,
and the file object. No success.
Can anyone tell me how to do this?

Thanks in advance.

Francois

Hi Francois,

have a look at the various exec() methods in java.lang.Runtime, this is
perhaps what you are looking for.

But beware that their use is somewhat tricky, as you have to consume the
process' output, else it may block when some internal buffer is full.

I can send you some helper class for Runtime.exec(), just send me a
short email to /d/5/0/3/@/d/i/r/e/c/t/b/o/x/./c/o/m , without the
slashes, of course :)

Cheers
Andreas
 
F

Francois Lionet

I want to launch an external program from my application (currently under
have a look at the various exec() methods in java.lang.Runtime, this is
perhaps what you are looking for.
Cheers
Andreas

Thanks Andreas, this was exactly what I was looking for. Does anyone know an
address where I can download the Java SE Platform 6 docs all at once? I'd
rather have the docs on my machine, and I could not find a link on the Sun
site...

Francois
 
R

Robert Mark Bram

Hi Francois,

One thought about this aspect.
but I want it to work as well on a Mac and Linux). I have the
pathname to the application (as a File object). But I can't find the method

The path (and even name) of your command might be different in the
different environments. It would be worth while to externalize the
definition of your command into a database or properties file that can
be changed for each environment.

Rob
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top