I am launching a JNLP java application from a native client app (i.e. not a browser). When the JNLP finishes it's task, I need it to return a string to the calling app? How can I do this? Is it possible to return a value to a calling app - or do I need to have the calling app listen on a port and have the JNLP app write the value to that port through sockets?
Answering my own question!
I write to stdout from the child process (the JNLP)
The parent launches the child process
Process::Start
Read stdout from Parent
string ret = process.StandardOutput.ReadToEnd();
Process::WaitForExit();
Anyone sees any problem in this?
If the all-permissions
element is specified, you could try to set an environment variable which you can read from your C# application.
Set environment variable in Java:
System.getenv().put("returnValue", "yourValue");
Read environment variable in C#:
ProcessStartInfo p = new ProcessStartInfo("start ....");
....
string returnValue = p.EnvironmentVariables["returnValue"];
I like your idea to use sockets and think this is could be an easy solution.
It is not possible to get return values from a WebStart-application. Just see the help message from
javaws --help
There is no return-code available. (Sorry)
Have you thougth on a temporary file instead of the sockets?
It's a bit old but as fas as i know this is the exiting options to intercommunicate two process link.
I think the easiest way to solve your problem is use rmi, or jmx if you can, or just a simple socket
© 2022 - 2024 — McMap. All rights reserved.