• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to invoke perl script on unix server from local machine

 
epooagg Aggarwal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
syntax for sh and bash: PATH="$HOME/bin:$PATH";
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"afteam afafteam", please see your private messages regarding an administrative matter.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use System.exec(), passing the name of the script.
 
Pradeep Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic