Two Laptop Bag*
The moose likes Java in General and the fly likes Communication between Java and Perl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Communication between Java and Perl" Watch "Communication between Java and Perl" New topic
Author

Communication between Java and Perl

Abhijeet Sinha
Greenhorn

Joined: Sep 15, 2011
Posts: 10
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

Joined: Jun 22, 2005
Posts: 1511
Can we call java program from perl script?


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
The java.lang.ProcessBuilder class comes to mind, and, of course, Runtime.exec.
Abhijeet Sinha
Greenhorn

Joined: Sep 15, 2011
Posts: 10
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

Joined: Apr 06, 2010
Posts: 4241
    
    7

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

Joined: Sep 15, 2011
Posts: 10
it will be an array of three strings,but the length of string is large.
Abhijeet Sinha
Greenhorn

Joined: Sep 15, 2011
Posts: 10
can any one give me some simple examples how to do that..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communication between Java and Perl
 
Similar Threads
Calling perl scrip from java program
Web interface to delete folder
How to call a cgi/perl script from jsp/java bean
Determine current user
How Java Appl comunicate with CGI/Perl script