- Joined
- Feb 25, 2008
- Messages
- 1
- Reaction score
- 0
Hi all,
I am using the following java code to invoke a perl script named helloworld.pl. When i run the perl script individually, it displays "Hello world" on the console, but it is unable to produce the same o/p when called from java. It does nothing and no o/p is displayed. I dont know what im doing wrong.
---------- Java code -------------
import java.io.IOException;
class Test
{
public static void main (String [] args)
{
try {
String cmdString
= "perl /home/admin/helloworld.pl";
Runtime.getRuntime().exec(cmdString);
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
------------------------------------------------------------------------
-------------------- Perl Code -----------------
#!/usr/bin/perl -I/usr/local/lib/site_perl
print "hello world";
-------------------------------------------------------------------------
Please help me guys.....
I am using the following java code to invoke a perl script named helloworld.pl. When i run the perl script individually, it displays "Hello world" on the console, but it is unable to produce the same o/p when called from java. It does nothing and no o/p is displayed. I dont know what im doing wrong.
---------- Java code -------------
import java.io.IOException;
class Test
{
public static void main (String [] args)
{
try {
String cmdString
= "perl /home/admin/helloworld.pl";
Runtime.getRuntime().exec(cmdString);
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
------------------------------------------------------------------------
-------------------- Perl Code -----------------
#!/usr/bin/perl -I/usr/local/lib/site_perl
print "hello world";
-------------------------------------------------------------------------
Please help me guys.....