Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Execute commands in putty prompt through java

Execute commands in putty prompt through java

Scheduled Pinned Locked Moved Java
javasysadminhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kartikdasani
    wrote on last edited by
    #1

    I need to execute unix commands in the putty prompt via java code. So far : String[] cmdArray = {"putty.exe", "server IP"}; Runtime.exec(cmdArray); has got the prompt open. Need help to interact with this window and execute other commands.

    N D 2 Replies Last reply
    0
    • K kartikdasani

      I need to execute unix commands in the putty prompt via java code. So far : String[] cmdArray = {"putty.exe", "server IP"}; Runtime.exec(cmdArray); has got the prompt open. Need help to interact with this window and execute other commands.

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      Try reading the documentation[^]. You should be able to execute a remote file, see 3.8.3.6 -m: read a remote command or script from a file in the above link.


      Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

      1 Reply Last reply
      0
      • K kartikdasani

        I need to execute unix commands in the putty prompt via java code. So far : String[] cmdArray = {"putty.exe", "server IP"}; Runtime.exec(cmdArray); has got the prompt open. Need help to interact with this window and execute other commands.

        D Offline
        D Offline
        David Skelly
        wrote on last edited by
        #3

        ProcessBuilder and Process may help. You can get an output stream for the Process and send input to the command line through that.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups