File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Calling Perl Script in Java. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calling Perl Script in Java." Watch "Calling Perl Script in Java." New topic
Author

Calling Perl Script in Java.

chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

Hi all,

I have a couple of PERL scripts already written. I am developing an application using Swing. My requirement is that whenever some button is pressed i want to call a PERL script that will do its task.

Or the other way to put this would be that i m developing a GUI application which will call perl scripts in the background.Is this kind of thing possible?


Enjoy, Chander
SCJP 5, Oracle Certified PL/SQL Developer
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38036
    
  22
Not a beginner's question. Moving.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Have you taken a look at the Runtime and Process classes? Oh and don't forget to Google "Why Runtime.exec() won't" for a classic article on the pitfalls to avoid when using these classes.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41127
    
  45
Is it certain that Perl will be installed on the machines where this application will run?

On Windows, another option would be to get hold of an old BSF version (2.3 or older); those versions support calling PerlScript code.


Ping & DNS - my free Android networking tools app
chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

Ulf Dittmer wrote:Is it certain that Perl will be installed on the machines where this application will run?


Yes, PERL will be installed on the machines
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Chander,

If you have a copy of the Java Cookbook, 2E available, there is at least one recipe on using Perl scripts with Java..

John
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Opens pg 763.... Ah it says "use the Inline:Java" module for PERL
 
jQuery in Action, 2nd edition
 
subject: Calling Perl Script in Java.
 
Similar Threads
Call a Perl Script From JSP
tomcat and perl scripts
Communication between Java and Perl
Calling perl scrip from java program
Calling a servlet from shell script / Perl script