• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

calling perl from Java

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai All,
Is it possible to call Perl from java.
If possible please let me know.
For calling perl from java ,what are the requirement
whether we have to include any jar files or something releated to perl

Thanks in advance

Regards,
Udhaya
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Java's exec() capabilities to start a Perl process just like you can run other applications. You must handle the resulting standard in, out and error streams as discussed many times in this and other forums.
You will have to have a Perl interpreter installed on your system, but nothing extra on the Java side.
Bill
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also search for similar scripting languages to Perl available for Java. For example, the article below says Sleep and Perl is similar:

http://today.java.net/pub/a/today/2005/07/14/sleep.html
 
udhaya kanagaraj
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
Thanks for your replies.
I shall try out that.

Regards,
Udhaya
 
udhaya kanagaraj
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai All,
I executed the following piece of code

try{

Process p1 = Runtime.getRuntime().exec("cmd.exe /c perl.exe -S
samplePerl.pl");

} catch(Throwable event){
System.err.println("Exception occured"+e);
}

It is not giving the output.can anyone tell the error in this or what I have to do further.
Thanks in advance

Regards,
Udhaya
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where did you expect the output to go?
See the Javadocs for java.lang.Process - paying especial attention to the discussion of the input, output and error streams.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic