Help running external processes

With my program I want to run an external program. This might be a little beyond my current understanding of Java, but I'd really like to know how to do this. Also, I'd like to know how to (if it's possible) convert the .exe I want to run into a .class file or something else that will let me package it in the .jar.

I had done something similar with a VB application that would launch the external program from a .dat file.

If anyone can help out that'd be great.

[487 byte] By [Spirastera] at [2007-11-27 9:59:16]
# 1

> With my program I want to run an external program.

> This might be a little beyond my current

> understanding of Java, but I'd really like to know

> how to do this.

Runtime rt = Runtime.getRuntime();

Proces proc = rt.exec("my_external_program");

Also, google for "When runtime.exec doesn't". It's required reading for anyone using Runtime.exec.

> Also, I'd like to know how to (if

> it's possible) convert the .exe I want to run into a

> .class file or something else that will let me

> package it in the .jar.

Well, you can stick anything you want into a .jar. I don't know if there's a good way to Runtime.exec it from the .jar though. Your program could extract it to a known directory--even the default temp directory--and run it from there.

jverda at 2007-7-13 0:30:19 > top of Java-index,Java Essentials,New To Java...