简体   繁体   中英

Package plink with jar

I have written a code (Java using eclipse Juno) which uses plink (C: installation) to connect to a remote server.

String command = "C:\\Program Files\\PuTTY\\plink -load session-name -l login -pw password";
Process p = runtime.exec (command);

Is there anyway I can safely export it (putty/plink) along with the jar file. This is so as there would not be any need of separate installation. I would also have to alter the code to call plink locally.

Thanks.

Use jar utility that comes with Java SDK to package putty executables to your application jar file.

Upon installation you can extract your exe file to a folder. And later call it from your code .

I am using the below code in plink.

"C:\\Users\\YXS8699\\Desktop\\Desktop\\ansi165\\x86\\ansicon.exe \\"C:\\Progra~1\\PuTTY\\plink.exe\\" ";

It was working fine.

Now when we run the plink command to connect WYSE50 terminal. I am facing the below issue

Command Prompt: "C:\\Program Files\\PuTTY\\plink.exe" CPHPQPU1.homedepot.com -l dbxd -pw 123summer -t WYSE50

Using keyboard-interactive authentication. Password:

Now it is not working fine. Please give me some inputs.

Regards, Yellappa

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM