This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes how to invoke perl script on unix server from local machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "how to invoke perl script on unix server from local machine" Watch "how to invoke perl script on unix server from local machine" New topic
Author

how to invoke perl script on unix server from local machine

epooagg Aggarwal
Greenhorn

Joined: Sep 13, 2011
Posts: 3
Hi,
I have a perl script on a Unix server, and want to invoke the this perl script from my local machine using java code.
Can anybody please help me as I am new to Unix and perl both.
afteam afafteam
Greenhorn

Joined: Apr 09, 2012
Posts: 1
syntax for sh and bash: PATH="$HOME/bin:$PATH";
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

"afteam afafteam", please see your private messages regarding an administrative matter.


JBoss In Action
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Use System.exec(), passing the name of the script.
Pradeep Kumar
Ranch Hand

Joined: Sep 08, 2006
Posts: 108
To execute the pel script from the Java code you can use the ProceeBuilder API from Java. I would prefer ProcessBuilder over System.exec since the former gives you a handle to the inputStream as well as the outputStream. Here is the sample code.



Hope this helps

Regards,
Pradeep

http://www.unixonthego.com


Thanks and Regards, Pradeep Kumar
SCJP 1.6, SCWCD 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to invoke perl script on unix server from local machine
 
Similar Threads
Call UNIX commands from JAVA
Using getRuntime().exec() within EJB
How can i embedded Perl Script in JSP?
Do I have to use JNI to invoke Korn shell or perl script from java ?
to upload a file to a remote server on the network