Running external java program

Hi all,

I need to run an external java program from my application.

The external program can be executed command prompt as follow

c:\> java -classpath SDMetrics.jar sdmetrics.SDMetricsand another argument

Since I use the output of the above command , I prefer to do that as a part of my application, in which the external program will be run automatically in my application.

Any help will be appreciated

zara 75

[467 byte] By [zara75a] at [2007-11-27 3:45:59]
# 1
If I understand you correctly, then I'd suggest that you modify the external program such that it has an API that you can use in the other program.
paulcwa at 2007-7-12 8:49:44 > top of Java-index,Java Essentials,Java Programming...
# 2
Thanks,unfortunately the external program does not provide any API, and I does not has any access to the source code!!what about the Runtime class?
zara75a at 2007-7-12 8:49:44 > top of Java-index,Java Essentials,Java Programming...
# 3
Yeah you can use Runtime.exec (or, if you're using JDK 1.5, ProcessBuilder) to exec the program as a separate process.Read this about it: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
paulcwa at 2007-7-12 8:49:44 > top of Java-index,Java Essentials,Java Programming...