Hi guys,

My code below works well when it's assumed that PuTTY is resident on the Windows machine where this application is running, and have PuTTY connect to a Linux server on the local network.

//more code
Runtime r = Runtime.getRuntime();
        Process p = null;
        String s = "C:\\Program Files\\PuTTY\\putty.exe -ssh -l jimmy -pw jim123 192.168.0.51";
        try
        {
            p = r.exec(s);
            p.waitFor();
        } catch (Exception e)
        {
            System.out.println("Exception error :"+e.getMessage());
            e.printStackTrace();
        }
//more code

My question is, how can I specify the IP for the actual location of putty.exe instead of having it assumed as localhost?

Am guessing something along the lines of:

//more code
String s = "\\192.168.0.77\\C:\\Program Files\\PuTTY\\putty.exe -ssh -l jimmy -pw jim123 192.168.0.15";//which doesn't work but gives you a picture of what I'm trying to achieve
        try
        {
            p = r.exec(s);
            p.waitFor();
        } 
//more code

Any useful guide will be much appreciated.

Thank you all.

please authors site contains that

Please mKorbel, if you have a URL that shows how to deal with my specified challenge above, I would appreciate it, because the closest response from http://www.chiark.greenend.org.uk/~sgtatham/putty/faq.html#faq-ipc, (the FAQ), is
A.6.5 How can I start an SSH session straight from the command line?

Use the command line putty -ssh host.name. Alternatively, create a saved session that specifies the SSH protocol, and start the saved session
Doesn't come even close to solving my problem, does it?

The only thing that is evading me is the way to connect from computer A with Windows to computer B also with Windows, but also having an exe program(putty as an example in this case) and running it!!

Most help I'm getting is on how to do it locally and not externally from a computer in the same network.
check out this for instance:
http://www.rgagnon.com/javadetails/java-0014.html

Someone knowledgeable in this please assist

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.