Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communication between Java and Perl

 
Abhijeet Sinha
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to call a perl scripts from my java application. this perl script will receive parameters and after execution returns to the application
Can you tell me how to call this perl script from java. What are the exceptions i have to take care of when calling and returning from the script
Is it possible to call another script from the perl script and keeptrack of exceptions that may arrise in inter calling.

Thanks in advance
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we call java program from perl script?
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java.lang.ProcessBuilder class comes to mind, and, of course, Runtime.exec.
 
Abhijeet Sinha
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to pass arguments from a java code to native script?
I want to pass an array form my java code to a perl script.how to pass and how to receive it there in perl script
any idea..?

thanks in advance
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Small array, or big array? For a small array you could add them to the perl command line you're calling. For a bit array, the simplest approach I can think of is to save it to a temporary file, and pass the filename to the perl script.
 
Abhijeet Sinha
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it will be an array of three strings,but the length of string is large.
 
Abhijeet Sinha
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one give me some simple examples how to do that..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic