The moose likes Beginning Java and the fly likes executing perl scripts from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "executing perl scripts from java" Watch "executing perl scripts from java" New topic

executing perl scripts from java

dan nwankwo

Joined: May 23, 2001
Posts: 8
How can i execute a perl script from within my java programme. The script is designed to output a text file. i then want my program to read the file and display stuff. Thanks
Valentin Crettaz
Gold Digger

Joined: Aug 26, 2001
Posts: 7610
I have never tried that but I think you could use the java.lang.Runtime.getRuntime().exec() method and passing the Perl interpreter and the Perl script as argument to that method.
Something like:
Runtime run = Runtime.getRuntime();
Process proc = run.exec("perl myscript.pl");

[Blog] [Blogroll] [My Reviews] My Linked In
It is sorta covered in the JavaRanch Style Guide.
subject: executing perl scripts from java
Similar Threads
How to call a cgi/perl script from jsp/java bean
To check if there are any open file descriptors on a text file
Communication between Java and Perl
Urgent: Calling perl from Java
how to invoke perl script on unix server from local machine