• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem calling perl from java

 
Sneha Durvasula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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();
 
fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
Brian Bykenhaal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic