Discussions

General J2EE: JNI and J2EE

  1. JNI and J2EE (1 messages)

    ai Everybody,
    I need to call a set of PERL modules from a J2EE application server using java classes (probably using
    JNI).

    Is it possible ? (Does J2EE allow JNI ?).

    If so which Application Servers allow this ?

    If i cant use JNI, what are the alternatives ?

    Thanks in advance.

    Anne

    Threaded Messages (1)

  2. JNI and J2EE[ Go to top ]

    Two alternatives:


    1. Use the java.lang.Runtime class with the exec() method. Call the perl script and read the output. The problem here is that you might block and the format of the call is system dependant.

    2. Modify your perl application to be a server. You could use XML-RPC, SOAP, HTTP, etc ... Then write java code to call the server.

    I've used (2) in the past with XML-RPC to have Java and VB clients call my perl. I ran the perl program in Apache using mod_perl. This works well if you allready have an Apache instance. Otherwise, I believe that the Perl XML-RPC module has the ability to create a simple server for you.

    -Dave