File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Start a script  ( where a server is defined) from a java application Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Start a script  ( where a server is defined) from a java application" Watch "Start a script  ( where a server is defined) from a java application" New topic
Author

Start a script ( where a server is defined) from a java application

Laura Antanas
Greenhorn

Joined: Jun 01, 2006
Posts: 3
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).
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12324
    
    1
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


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Start a script ( where a server is defined) from a java application
 
Similar Threads
exception???
connection refused to SocketServer when started from junit
cannot read at java ServerSocket till C# client close
Restarting Tomcat service on a remote machine from Hudson
How to Start RMI server on System Boot Up