in reply to How to call perl in Java?

Obviously a system call does the trick as suggested by Ratazong. I don't really like the file based communication though. It's also possible to embed your Java code in Perl and make it work together like marto suggested. But at first sight PLJava doesn't look very actively supported. Another option might be Inline::Java::Callback. I recently read XML-RPC, to call perl routines from Java. I like the idea a lot. I still have to try it though.

What kind of inter-program-communication (if any) are you looking for?

Cheers,

dHarry

Replies are listed 'Best First'.
Re^2: How to call perl in Java?
by llancet (Friar) on Jan 08, 2010 at 03:30 UTC
    Not very sure, actually. Maybe I need to have java objects passed as perl sub arguments. For example:
    In foo.pm
    package foo; sub run_foo { my($obj1,$obj2) = @_; # access passed java object $obj1->method; $obj2->attribute; } 1;
    In java:
    PerlEnviromnent foo = loadPerlPackage("foo.pm"); foo.runSub('run_foo',some_object,another_object);

      Passing Java objects to Perl subs sounds tricky, objects can be arbitrary complex. Maybe you can use JSON for data transfer. You could serialize your Java object to a JSON string, pass it to Perl and decode it. See JSON in Java and JSON.

      HTH

      Harry

        I know that Inline::Java is able to use Java objects in perl code...