How to use POSIX in Java_ spawn()

I inherited a legacy application that uses process builder Start() executes the script on the Solaris 10 server

Unfortunately, this script call failed due to memory problems, as described here

Oracle's recommendation is to use POSIX_ Spawn(), because under the cover, processbuilder Start () uses fork / exec

I haven't been able to find any examples (for example, how to call "myscript. Sh")

Using POSIX in Java_ Spawn (), even the required package

Please give me a question about how to use POSIX in Java_ A simple example of spawn()?

Solution

You need to be familiar with JNI Learn how to call native routines from Java code When you're done – you can look at this example to see if it helps solve your problem You are particularly interested in:

if( (RC=posix_spawn(&pid,spawnedArgs[0],NULL,spawnedArgs,NULL)) !=0 ){
    printf("Error while executing posix_spawn(),Return code from posix_spawn()=%d",RC);

}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>