Execute jar in program code  
Author Message
kclan





PostPosted: 2003-8-20 12:32:00 Top

java-programmer, Execute jar in program code I have a jar file, without source code, say abc.jar.
I have set it in the CLASSPATH
The main execute class in abc.jar is a.class.
In the command prompt, I can execute the program by
issuing "java a < someIOfile"

But I would be like to embed it in my program.
Can I create a "dynamic" instance from it?
 
Brad BARCLAY





PostPosted: 2003-8-20 13:34:00 Top

java-programmer >> Execute jar in program code Cyrus Lan wrote:
> I have a jar file, without source code, say abc.jar.
> I have set it in the CLASSPATH
> The main execute class in abc.jar is a.class.
> In the command prompt, I can execute the program by
> issuing "java a < someIOfile"
>
> But I would be like to embed it in my program.
> Can I create a "dynamic" instance from it?

Sure. Just call "a.main(params)". It's a static method no different
from any other Java method, so you can call it as you desire from within
any Java code.

Brad BARCLAY

--
=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project: http://www.jsyncmanager.org