Is it possible to execute commands remotely (ssh), through a Java program

akshay1188

I am looking to ssh into an Ubuntu Server via some (java) API. Is that even possible?

Here is what I am looking for exactly:

  • I have setup OpenStack on an ubuntu machine.
  • Launched an instance with ubuntu server.
  • Installed android SDK on this Virtual Machine.
  • By ssh-ing into this Virtual Machine, I am able to create an AVD and run an emulator (headless).

What I plan to do is provide some web client to start the emulator at the click of a button (considering everything is already set up i.e the Virtual Machine is up and running with the SDK installed).

I guess I need to execute the command to start the emulator. But is it possible to do this via some (java) API? I had a look into openstack4j and JClouds but could not find much. I tried to figure out it is using some ssh client library. Is that right?

Anything I am missing here?

Everett Toews

Have a look at this CloudServersPublish.java example, in particular the configureAndStartWebserver() method.

Also note how the SshjSshClientModule is added to the ComputeServiceContext in the constructor.

You'll also need to make sure you have the jclouds-sshj dependency.

<dependency>
  <groupId>org.apache.jclouds.driver</groupId>
  <artifactId>jclouds-sshj</artifactId>
  <version>1.9.0</version>
</dependency>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Execute commands on linux remotely through Dropbox ?

From Dev

Passing Hadoop program commands through Java Program

From Dev

Passing Hadoop program commands through Java Program

From Dev

Send Commands remotely from Windows to Linux through Java

From Dev

ssh master - execute su remotely

From Dev

Execute several commands through ssh with local and remote values

From Dev

Execute concurrent SSH commands?

From Dev

Execute concurrent SSH commands?

From Dev

Execute commands with ssh

From Dev

How to execute multiple commands remotely on few servers?

From Dev

Remotely execute commands but still have control of the host

From Dev

How to autorun commands on OSX when ssh remotely?

From Dev

Execute a sudo NOPASSWD command remotely via SSH

From Dev

Read and write multiple commands on command prompt through java program

From Dev

Streaming output of a remotely executed program via ssh

From Dev

run ipython notebook remotely through ssh tunneling

From Dev

Open GNOME session remotely through SSH

From Dev

Issue with setting environment variable through bat file to execute a java program

From Dev

Is it possible to “SSH” into my virtual machine remotely?

From Dev

Is it possible to “SSH” into my virtual machine remotely?

From Dev

using subprocess to ssh and execute commands

From Dev

execute multiple commands after ssh

From Dev

Jenkins - can the "Execute Shell" execute SSH commands

From Dev

How to execute the java program of apache thrift (with ant if possible)

From Dev

Remotely starting a screen session through ssh and closing the ssh session immediately

From Dev

Remotely starting a screen session through ssh and closing the ssh session immediately

From Dev

Problems using scala to remotely issue commands via ssh

From Dev

Remotely execute program in multiple EC2 instances and wait for results

From Dev

Execute script remotely over SSH and disconnect from running process

Related Related

  1. 1

    Execute commands on linux remotely through Dropbox ?

  2. 2

    Passing Hadoop program commands through Java Program

  3. 3

    Passing Hadoop program commands through Java Program

  4. 4

    Send Commands remotely from Windows to Linux through Java

  5. 5

    ssh master - execute su remotely

  6. 6

    Execute several commands through ssh with local and remote values

  7. 7

    Execute concurrent SSH commands?

  8. 8

    Execute concurrent SSH commands?

  9. 9

    Execute commands with ssh

  10. 10

    How to execute multiple commands remotely on few servers?

  11. 11

    Remotely execute commands but still have control of the host

  12. 12

    How to autorun commands on OSX when ssh remotely?

  13. 13

    Execute a sudo NOPASSWD command remotely via SSH

  14. 14

    Read and write multiple commands on command prompt through java program

  15. 15

    Streaming output of a remotely executed program via ssh

  16. 16

    run ipython notebook remotely through ssh tunneling

  17. 17

    Open GNOME session remotely through SSH

  18. 18

    Issue with setting environment variable through bat file to execute a java program

  19. 19

    Is it possible to “SSH” into my virtual machine remotely?

  20. 20

    Is it possible to “SSH” into my virtual machine remotely?

  21. 21

    using subprocess to ssh and execute commands

  22. 22

    execute multiple commands after ssh

  23. 23

    Jenkins - can the "Execute Shell" execute SSH commands

  24. 24

    How to execute the java program of apache thrift (with ant if possible)

  25. 25

    Remotely starting a screen session through ssh and closing the ssh session immediately

  26. 26

    Remotely starting a screen session through ssh and closing the ssh session immediately

  27. 27

    Problems using scala to remotely issue commands via ssh

  28. 28

    Remotely execute program in multiple EC2 instances and wait for results

  29. 29

    Execute script remotely over SSH and disconnect from running process

HotTag

Archive