• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem calling perl from java

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to call a perl script at a central location using java with arguements..I have used the following code and it does nothing..Can someone tell me whats missing


final List<String> commands = new ArrayList<String>();

commands.add("perl");
commands.add("I:/golden_scripts/make-tp-patch.pl");
commands.add(destpath+"/"+"scrfile.txt.org");
commands.add(pro_name);
commands.add(patch);
ProcessBuilder pb = new ProcessBuilder(commands);
Process p1 = pb.start();
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Does nothing" isn't terribly specific. Does it compile? Does it throw an exception? Does it run but not do what you expect? If so, what DO you expect, and what - EXACTLY - did it print?

Do you know the perl script works? Can you call a simpler perl script and see if that works - something that would have a result you can see, like touching a file?

I have never called perl from java (or java from perl). I do know there are some caveats with using the process builder, but i've never really paid much attention. I'm sure if you search the various forums here you can find someone who has linked to it.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to create a caller org.perl.inline.java.InlinePerlCaller

I read that you need to use java inline also I have found some using XML-RPC and ProcessBuilder.

Rakudo lets you run Jvm and Perl 5 together. Rakudo Perl is a client compiler for the Parrot virtual machine and the Java Virtual Machine that implements the Perl 6 specification.

Java inline http://search.cpan.org/~patl/Inline-Java-0.52/Java.pod
 
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic