Results 1 to 5 of 5
  1. #1
    paddala is offline Member
    Join Date
    Jul 2008
    Posts
    11
    Rep Power
    0

    Default 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...

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    Hello

    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:
    Java Code:
     Process p = Runtime.getRuntime().exec("my command");
    And second - remote machine execution - can be some Socket client/server solution

    cheers!

  3. #3
    paddala is offline Member
    Join Date
    Jul 2008
    Posts
    11
    Rep Power
    0

    Default

    can i write the ruby script for the server in shell script?
    Last edited by paddala; 02-12-2010 at 03:48 PM.

  4. #4
    senorbum is offline Member
    Join Date
    Aug 2009
    Posts
    76
    Rep Power
    0

    Default

    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.

  5. #5
    paddala is offline Member
    Join Date
    Jul 2008
    Posts
    11
    Rep Power
    0

    Default

    Quote Originally Posted by senorbum View Post
    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?
    thanks a lot senorbum....that link was very helpful :)
    Last edited by paddala; 02-16-2010 at 08:22 PM.

Similar Threads

  1. Connecting to Server Application
    By andre1011 in forum Networking
    Replies: 1
    Last Post: 10-29-2009, 07:29 AM
  2. connecting to remote SQL server
    By mahasarathi in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 04-04-2009, 06:11 AM
  3. Applet connecting to server
    By zenMarko in forum Java Applets
    Replies: 1
    Last Post: 11-15-2008, 04:32 PM
  4. Connecting To SQL Server
    By rmaadil in forum JDBC
    Replies: 7
    Last Post: 08-20-2008, 05:53 PM
  5. Connecting to a Web server
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-07-2008, 07:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •