Solution?
-- it looks like i may be able to use the x-11 forwarding in jsch and and use the java Desktop class to launch a file browser. Not sure if this will work.
What I am trying to do is, within a java application, open a connection to a server or another computer. I have found a way to do this that opens a terminal window but what I want is a gui/explorer/finder like window that allows me to drag and drop files between the machines.
--Edit--
An example: When i use an sftp application i can open a graphical window and drag files from my computer to folders on the remote server. just like an explorer or finder window. I am looking for a way to implement this type of functionality in java. I want to open a connection to a remote machine, then open a graphical window to browse the file system
You can use JSch to communicate with the server through SSH and
1. create your own GUI or
2. use X11 forwarding
you need two applications in each machine ,you can do this by TLS connection.
however it need a waiting thread in costumer machine (dragable) to get file from Tls port and stream it to new location or if you want to use just gui in one machine you can old applet or java Fx instead .
Related
In our project (CMS) we are currently using Mindterm for launching SSH terminal to Network Elements and different Virtual Machines. Client download .jnlp file that launch Swing based GUI with ssh terminal to configured address.
Since mindterm is getting out of support at the end of this year (2021), we are looking for replacement, my question is can anyone recommend something providing similar functionality, we don't want into writing this by our own.
Thanks
P.S. I know that e.g. Putty, mRemoteNG exist but customer want to have ability start preconfigured with IP address terminal from CMS application.
I have a small server running Ubuntu (12.04.1 LTS). I can control the server from putty but I want to do this with GUI. I know how to create Java applications with GUI. Anyway my question is, how to send ssh command when button clicked.
The Jsch library allows you to do ssh programmatically from java. This should allow you to send the necessary commands from you gui to your server.
One more or less simple way to do this is to open a ssh tunnel and forward a port from your local machine to the server. I recommend using a key pair to omit entering a password. Next you write your application which could consist of two parts, your local GUI and some server which executes the commands on the server.
I still think that this a very complicated solution but the choice is yours.
I have a program that needs to read/write files to/from a network computer. Sometimes however the program cannot access the folder on the network computer. Currently, to fix this issue, I go into windows explorer's network section, click the computer, enter my credentials, and then my program is able to read and write to this computer without a problem. Is there a way to allow Java to ask for these credentials or a way to automatically send these credentials using java? I am using Win7 and Win7 embedded on the network computer.
You can use http://jcifs.samba.org/ which is a library for accessing remote CIFS shares. This allows you to set username and password and works on any platform (not just windows) It works without needing to mount a drive.
I'm remote controlling a Java application on a PC through an Android phone, and I needed my application to open a browser at the phones command, chrome in this case. I created a "Process" for chrome, opening a certain address. However, I need to be able to give tools on the Android phone for controlling the web page, such as scrolling. Can I programmatically send a command for chrome to scroll from my PC application containing the Process?
Sorry, it may have been unclear, but the only connection the android phone has to the program is through a socket. It is only used as a remote control for another Java application on a PC, which has its own screen.
I do not think that clean solution exists.
But I can suggest the following directions:
(1) try to investigate the native chrome API. If it has such ability call it with JNI.
(2) Try to use class java.awt.Robot. It allows to simulate user's activity, e.g. mouse clicks. Unfortunately it does not allow you to find any window outside your application, so it is a problem to decide where to perform the click.
(3) You can create proxy server and make browser you open to go to the target URL through the proxy. The proxy server will insert into the page your javascript that will communicate with server. The application that opens browser will send commands to server. The javascript that you inserted will receive these commands using AJAX and perform them. JavaScript can scroll browser window, so theoretically you can implement this.
If you can target the tab you want to control and edit the address bar you could send the command 'javascript:scrollTo(x, y)'. I just tested it on this page and it seems to work fine, replacing what I typed with the original address of the page.
Can I programmatically send a command for chrome to scroll from my PC
application containing the Process?
Not directly. What you could do is make some sort of web service that sits between the Android client and page that the Android client can send commands to and the page can periodically poll via AJAX calls to see what the client wants. That would be a clean DIY way that would work on other browsers besides Chrome.
You can use vnc viewer applications for that.
http://code.google.com/p/android-vnc-viewer/
I am developing a new Java Desktop app. Something like a media player. I want to load most of the resources in the background when the computer starts up. But the users can turn this option off form within the app or using some other utility. So, what I want to do is if a ban instance of the app is already running and the user starts the app again then I can communicate with the already running instance so that it can launch a new window?
The most known way to do that is to open a ServerSocket when first application starts on a well known port.
If ServerSocket fails to load, it's probably because an instance is already running.
In such a case, you can open a Socket and start to communicate your orders between both instances.
But you can also use far more sophisticated solutions, like Jini or JGroups.
Write the app so it has a server part
When it starts up, try to communicate to the server (if it is already running), and if that works, then the server should open a new window, and the client should die
This should give you an overview:
http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html
You could use ports.