connecting to a server
hey guys....i want to connect to a server and then perform a series of bash commands such as ls , cd etc... my end objective is to a run a particular script located on the server from a java applet....can u please provide some help on how to connect to a server and how to use these bash commands...
you can find solution in this article:
Running system commands in Java applications | java exec example | devdaily.com
For execution on remote machines check the comments at the bottom
of that article and links there.
So first thing is to get to know how to run external command on local machine:
And second - remote machine execution - can be some Socket client/server solution
Process p = Runtime.getRuntime().exec("my command");
can i write the ruby script for the server in shell script?
A rest call would certainly be one way. But if you are going to be doing simple command line operations there really isn't a good reason to set up a server. I personally use
JSch - Java Secure Channel
when I want to simply run command line operations on a remote server. Its very useful for running a shell script like you mentioned. It does take some tweaking of the examples to get correct, but I didn't have much of a problem programming it to my needs.
one more question....i m creating an applet and i dont want the different dialog boxes to show up....so i have a set default username and password but authentication fails every time....also i cant view the stack trace of the JSch exception....can u help me out on this one?
Originally Posted by senorbum
thanks a lot senorbum....that link was very helpful :)