Hauke D I have tried the following two ways of calling a simple Perl script that currently just prints out the fact that it has been reached from a Java Application. Both attempts were found from an internet search and have not been successful - the expected output is not observed in the Linux window that starts the Java application. Just a little background - the Java code and simple Perl script were developed using the Eclipse IDE and the Perl script resides within one of the previously existing Java packages (Utils)

// First Method List<String> cmds = new ArrayList<String>(); cmds.add("perl"); cmds.add("/home/rwest/workspace/src/AppMaint/Utils/PerlUtil.pl"); ProcessBuilder pb = new ProcessBuilder(cmds); pb.start(); // Second method Process p = RunTime.getRuntime().exec("perl /home/rwest/workspace/src/ +AppMaint/Utils/PerlUtil.pl"); p.waitFor();

Other things I have done in an attempt to get either method to work: 1) Changed the group (chgrp) and access rights (chmod) so that the Perl script exists in the same group as the Java application and has read and execute permission. 2)Added /home/rwest/workspace/src/AppMaint/Utils/PerlUtil.pl to the Eclipse manifest file classpath line. 3) Executed the Perl script from Eclipse IDE with success. 4) Stepped through Eclipse debugger to make sure the applicable Java application lines of code to execute the Perl script are executed.


In reply to Re^2: Calling Perl with arguments From Java by rgwest61
in thread Calling Perl with arguments From Java by rgwest61

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.