I need to connect my Java Application to Virtual Machine. After connecting I need to send String saved in my code to bash script, execute it, and then get the output of the script (it comes out in csv file), and then I need to compare it to another csv file that's in the code. I know how to compare it, but I don't know how to connect to Virtual Machine.
I would be very happy if someone could help.
Basicly, I don't know how to connect to Virtual Machine with my Java App, any comment will help, should I use socket? If so, where to start?
Well, i tried to connect to VM with running proces but that didn't worked out. It's a corporate Vitrual Machine, that runs opperations for clients.
Related
Relatively new to this but, I was planning to write a simple android application which can run and execute simple terminal commads like ssh, change directories etc. But i want to create buttons for each command. so (cd..) command will be a button, (mkdir) will be another. The main idea is to connect to a Linux server and then execute these commands on them, I would also use some commands which start services or kill services.
I want to know if there is any class in Android which allows me to run these commands programmatically?.
Thanks in advance.
I want to know if there is any class in Android which allows me to run these commands programmatically?.
No, unless you count Socket.
Instead, you would need to find an SSH client library for Android, or perhaps for ordinary Java (and hope that it runs unmodified on Android).
Using Java on a client machine I wish to execute a different Java program on a server.
I have a Windows 7 laptop that I'm using as a client machine, and I wish to run a simple java program on a MacBook Pro (this will be the server) from the client. The program on the server will be stored there, so there won't be any need for uploading the code from the client.
I am already running some Java Selenium tests remotely using Seleniums remote web driver, however Selenium cannot do everything I want which is why I need to execute a simple java program that will use the robot class to trigger a few keyboard events.
Is this possible?
(Essentially I want to run a java program on a client machine that executes some keyboard events on a server machine.)
Usual way to upload a file using Selenium is the following:
driver.findElement(By.id(<uploadId>)).sendKeys(<pathToTheFile>);
I hope it should be enough and you don't want to test browser specific popup dialog.
I want to write a program which connects to remote machines via ssh and install predefined software. Also I wanna make process of installing clear for users by make all it visible to users. I have faced some problems: how to open terminal from java and send commands to it?(OutputStream doesn't work) How to execute command in this terminal when I already ssh? I want to run local scripts on the remote machine and allow user? to interact with terminal, when script is running (for example accept licence of software and so on).
I was trying something like this but it is not working.
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("x-terminal-emulator -e ./script.sh");
In theory it is possible. You'll need a java library, such as JSch, to interact directly with a terminal via ssh, and then make use of the screen utility to share a single terminal screen between your java prog and a user.
From your java prog:
screen -d -m -S shared
screen -rx shared
<type your installation commands>
From the remote user:
screen -rx shared
Of course the remote user must wait until the java prog initializes the screen in order to attach to it.
Please note that all kinds of things can go wrong when you let users interact with the screen. Your program must be smart enough to handle it.
I want to develop a program for ubuntu platform, That listens to DialUp modem and get Calls and send them to my php program that's running on my localhost.
for example when somebody calls my phone line, my listener program give the number and run this query:
http://127.0.0.1:80/listen.php?caller=ThePhoneNumber
How can I do that? is there any classes in java for that?
I think you'd need native tools for that. You can make pppd answer the call and run a custom script or program. But I have not fiddled with that for a long time. See linux modem howto. There should be plenty of information.
I wanted to make a login program for remote desktop using windows terminal. I found tho that the amount of packets I have to recreate is ridiculous. Is there any pre-written code for just the login sequence?
I could not find an free-standing Java library for doing this kind of thing, but there are Java clients available. Take a look at the Java RDP client listed here and see if you can reuse some of their code.