Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Inline Java and standalone executable

by Anonymous Monk
on Jun 28, 2013 at 18:31 UTC ( #1041313=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script at the moment that requires an XLST 2.0 processor and this requires that I use Inline::Java which requires that a Java package is installed. I hoped that this perl script could be packed as a standalone executable using PAR::Packer and the pp module which usually works fine for me when I only need to use standard modules. Is there anyway for me to create a standalone executable that works and includes Inline::Java? I understand that this will probably be a large executable, but I just want to know if it's possible.

Comment on Inline Java and standalone executable
Re: Inline Java and standalone executable
by davido (Archbishop) on Jun 29, 2013 at 00:35 UTC

    I noticed this hasn't gotten much attention over the course of the day. Fridays are typically a little light on traffic, and the topic you're asking about is pretty specialized.

    If you haven't gotten a response here in a day or so, you might have better luck getting your question in front of someone who knows by directing it to the Inline mailing list. See http://lists.perl.org/list/inline.html for archives and subscription information. It's very low traffic (sometimes months go by with no messages, other times, several in a week). But I think you'll find someone there who can answer.


    Dave

Re: Inline Java and standalone executable (yes)
by Anonymous Monk on Jun 29, 2013 at 06:23 UTC

    Is there anyway for me to create a standalone executable that works and includes Inline::Java? I understand that this will probably be a large executable, but I just want to know if it's possible.

    Yes, of course it is possible

Re: Inline Java and standalone executable
by chrestomanci (Priest) on Jun 29, 2013 at 08:25 UTC

    Both perl and java can be embeded into another executable. (Compiled from C or suchlike)

    Could you build a single large binary that includes both perl and java, and organise the communications between the perl and the java portions in the C code that calls them both (via JNI and XS).

    I doubt it would be easy, but if it important that you have a single fat binary, then it should work.

Re: Inline Java and standalone executable
by syphilis (Canon) on Jun 29, 2013 at 08:28 UTC
    I've done this a few years ago with Inline::C, but I don't use Inline::Java at all.
    Obviously, the executable will need the Inline and Inline::Java modules packed into it, and I think you'll also need to accompany the executable with an appropriately named directory structure that contains the additional files that Inline::Java builds and uses.
    We should be able to work out the details from the error messages you get when you run the executable in an environment that can find neither a perl installation nor a java compiler.

    As davido suggested, the Inline mailing list is a good place for asking about this. (But that doesn't necessarily mean that it can't be solved here.)

    Cheers,
    Rob
      Thanks Rob. I guess the main thing confusing me is how to the executable made by pp calls files that are packed inside of it. I know it is essentially a zipped archive, but I still am unsure how to call anything inside it (such as saxon9he.jar which XML::Saxon::XSLT2 needs and finds by calling different directories).
        but I still am unsure how to call anything inside it (such as saxon9he.jar which XML::Saxon::XSLT2 needs and finds by calling different directories

        Hmmm ... I'd be thinking that if XML::Saxon::XSLT2 needs to find saxon9he.jar in either /usr/share/java/ or/usr/local/share/java/ then saxon9he.jar will need to be installed into one of those 2 locations - which will be a lot of fun if the user trying to perform that installation doesn't have the requisite permission.

        Maybe send a message to tobyink (the XML::Saxon::XSLT2 author) and ask him how you can use the module if you don't have permission to install saxon9he.jar into either of the allowed locations. (That's not the exact problem you're facing - but the answer could be relevant to your task.)

        Cheers,
        Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1041313]
Approved by hdb
Front-paged by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2014-09-18 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (121 votes), past polls