This is probably a bad idea, but it's just something I thought of. You could potentially setup an event handler in a standalone Java app that waits for an event that perl can fire. i.e. a file with a certain name gets created in a directory, then java's event handler fires and it knows to do it's thing. The Java method could then (again possibly but probably a horrible idea) write out a file to that same directory with a "requestid" in the file name so that perl knows when to stop monitoring that directory for the java functions output.
Again this is most likely an incredibly horrible idea, but it's just an option.