Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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: 12988
66
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic