开发者

How to fire Java method using bash

Suppose I launch a Java application:

java -cp whatever.jar com.example.Start

Process launches ok and keeps running with PID 1314.

Now I would like the system to fire a method by users request.

How can I use 开发者_开发问答bash to signal the running PID and have it fire a method?


My thought is to have bash echo data to the Java processes via a named pipe, which I'm pretty sure Java has support for.


To communicate with a Java process, you would normally use RMI from another process (this could be in the same JAR)

However, if you want a pure bash/unix utilities solution, you could have the application listen on a port for commands and send back responses. This means you could use plain telnet to send commands and get output. One example of this is to use a http server with wget or you could have a simple socket based solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜