Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Call PERL script from JAVA

807605Jun 14 2007 — edited Jun 14 2007
I am facing a problem in running a PERL script in JAVA in UNIX box..
I am able to call ther perlscript.

Perl script has
##########################
#! /usr/local/bin/perl
print "\nEnter Your Name :";
$name = <>;
print "\nYour Name is : $name\n";
exit 0;
####################################################
Perl script request for the INPUT(name) .

My Java program is
File perlfile = new File("test.pl");
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("perl "+perlfile);
####################################################

Here is the problem tat IT IS says error =2 ..What has to be the solution so tat i can CALL PERL SCRIPT as similiar to running it separatly in prompt { >perl test.pl }

PLEASE help me on this....
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 12 2007
Added on Jun 14 2007
5 comments
225 views