Results 1 to 4 of 4
  1. #1
    Jojomofoman is offline Member
    Join Date
    Dec 2010
    Posts
    21
    Rep Power
    0

    Default Connecting to linux web server and performing command line operations with Java

    Hey guys,

    I'm forever coping files all over the place on my Linux (CentOS 5) webserver and I'm wondering whether it's possible to fire command lines commands at the webserver to save me the hassle of logging into Putty and performing them myself.

    I've looked all over for any information regarding this but I can't seem to find any. I'm just wondering if you guys/girls have any information/useful links you could point me towards.

    Cheers!

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default

    If the code is running locally, make a call to Runtime.exec(), if not, you will probably need some sort of script that you can access remotely that performs the operation for you (imo not very safe)

  3. #3
    Jojomofoman is offline Member
    Join Date
    Dec 2010
    Posts
    21
    Rep Power
    0

    Default

    Quote Originally Posted by doWhile View Post
    If the code is running locally, make a call to Runtime.exec(), if not, you will probably need some sort of script that you can access remotely that performs the operation for you (imo not very safe)
    Yeah - It's a remote web server, so exec() commands wouldn't work.

    Like you said, accessing a remote script to perform the commands wouldn't be very safe which is why I'm wondering if it's possible to do from within Java.

  4. #4
    Jojomofoman is offline Member
    Join Date
    Dec 2010
    Posts
    21
    Rep Power
    0

    Default

    I've been searching around since making this post and I think i've finally found a solution, located at: Ganymed SSH-2 for Java

    Just installed the library and it all seems very straight forward!

Similar Threads

  1. Replies: 3
    Last Post: 08-25-2010, 10:21 AM
  2. Replies: 2
    Last Post: 07-02-2010, 02:20 PM
  3. linux command to start a java web server
    By lazarus in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 06-24-2008, 03:30 PM
  4. calling linux command line in java
    By fangzhong in forum New To Java
    Replies: 0
    Last Post: 02-03-2008, 04:24 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 AM

Posting Permissions

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