Reputation: 11916
I need to add a service to my web application which opens a java process from command line and communicates through input/output streams of that jvm thread instead of using IDL or sockets or database or files. Is there such connection between processes, which is very close to pure java?
C# webserver opens helloworld.jar and writes 1M bytes to console of it(console.in), then waits for console.out. I've read that command line arguments cannot go beyond kilobytes level. Maybe streams can go megabytes if there is such communication?
Communicating with only strings would be ok but using objects themselves would be better.
Upvotes: 1
Views: 146
Reputation: 8725
In this answer I demonstrate the way to IPC
using stdin/out between executiable-jar
(STW
application) and a Winform
application.
The answer was linked into a solution I made.
To read and write into the application you use the methods: WriteLine
and OutputDataReceived
(a Process
methods, see this class).
In the Java
process you use Scanner
to read and Println
to write.(this is the java class)
The communication is through strings. You can serialize your objects into json and then pass them.(Using Json.net
and Gson
)
Upvotes: 1