Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > I need help in executing perl script from java in linux

Thread Tools

I need help in executing perl script from java in linux

amarpreetsinghgill amarpreetsinghgill is offline
Junior Member
Join Date: Feb 2008
Posts: 1
Hi all,
I am using the following java code to invoke a perl script named 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 -------------
class Test
public static void main (String [] args)
try {
String cmdString
= "perl /home/admin/";
catch (IOException e) {
// TODO Auto-generated catch block
-------------------- Perl Code -----------------
#!/usr/bin/perl -I/usr/local/lib/site_perl

print "hello world";

Please help me guys.....
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl Pro but Java Newbie: Need nudge in proper direction for myfavorite Perl routine in Java /usr/ceo Java 32 09-15-2008 12:12 AM
Issue in executing more than one perl script from Single perl script Perl Misc 3 11-01-2007 06:19 PM
executing linux shell script from within C++ 1 07-23-2007 02:25 PM
Problem in executing a script on the server side ! Script found but nothing executed ! CÚdric RossÚ ASP .Net 1 11-09-2004 09:43 AM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM