[Logo]
Forums Register Login
Start a script ( where a server is defined) from a java application
Hello,
I have a problem. I have an sc.exe application and 2 scripts (host.sc, client.sc). From command line they can be started like:
sc -c 'read host.sc'
sc -c 'read client.sc'

the problem is that I want to start the server from a java aplication and I do it like this:

try {
p = Runtime.getRuntime().exec("sc.exe -c \'read tool.sc\'");
} catch (IOException e1) {
// TODO
e1.printStackTrace();
}
and it works fine. The client I start from the command line. what happens is that the comunication between them fails. After the TCP/Ip connection is done it somehow fails...or it is never established corectly?!?
The other way around it works just fine (client atrted from java and server from commnd line).
It appears that you have not made provision for handling the output streams resulting from the exec of the sc.exe program. Read the Javadocs for java.lang.Process

Bill
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA


This thread has been viewed 557 times.

All times above are in ranch (not your local) time.
The current ranch time is
Aug 20, 2018 07:28:55.