Java Remote File Options
I've recently started an internship and I'm having some issues with Java in the enterprise environment. I've been assigned the task of porting the functionality of an old windows shell script to java so it may be ran on one of our JVMs.
The shell script runs on one of the Windows servers and grabs the previous days log files from a couple of linux boxes then FTPs them to another Windows machine.
I'm not quite sure how to achieve this functionality using java. I only can SSH into the linux boxes. I have got the connection working for the Windows file share, just not sure of the best way to connect to the linux boxes.
I've considered using one of the SSH libraries, but would prefer to avoid using a third party library.
Any insight would 开发者_开发百科be great. Thanks!
Java development is all about the appropriate use of third-party libraries. You can try and avoid it, but you won't get anywhere.
I suggest using JSch for your SSH/SCP/SFTP needs.
You're looking for SFTP. Look at How to retrieve a file from a server via SFTP?.
Try using SCP (an FTP-style way to transfer files, but it uses SSH) to transfer the files from Linux.
精彩评论