This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes How to execute linux script remotely from java program on windows Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "How to execute linux script remotely from java program on windows" Watch "How to execute linux script remotely from java program on windows" New topic
Author

How to execute linux script remotely from java program on windows

Srinivas Kumar
Ranch Hand

Joined: Jul 14, 2005
Posts: 52
Hi,
I want to execute a linux script from my java program residing on a windows machine. Can anybody help me in this regard? I can use the other tools like telnet to connect to linux machine and execute scripts but I would like to do it from the java program without going through the tools.
Appreciate your suggestions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35443
    
    9
A Java application can use Telnet programmatically through a library like Apache Commons Net. That would be one way.

Another would be to run a servlet (or some kind of server-side web component) on the Linux box that starts the script using ProcessBuilder or Runtime.exec. The Java app could then start it by accessing a particular URL.


Android appsImageJ pluginsJava web charts
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

J2ssh is an open source library that supports ssh2 protocol.
You can use this library to login to the unix box remotely and do what you want


apigee, a better way to API!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to execute linux script remotely from java program on windows
 
Similar Threads
logging into linux machine through java
Call UNIX commands from JAVA
Automatic execution of java file using bat or something else
Process type
Config window loading very slow