I am working at an application in java from windows. I have to connect to a server. I only know the ip: 172.... and port. I want to obtain the last modified date for a file on that server. I have tried some methods but it doesn't work. I read a lot about http, ftp, sftp but this things are not clear for me, and i could not understand how to obtain the date. Please help me!
I have tried with urlConnection, with ftp etc..
On windows the file sharing protocol is CIFS.
You have a java Open source library which implement this protocol : jcifs
Related
There are some posts regarding how to read from/write to a file in a remote system. However, I haven't found one useful to my purposes and I hope you can help me out.
So far, I have a java program that can connect to a server using sockets. The remote system (server) is not in the LAN which I think makes it more complicated to access files in that computer. The purpose of my "networking program" is to download files that are in the remote server and I can achieve this by copying bytes of the file once I have reached it, but I don't know how to "navigate" through the directories of the server. The only thing I've done so far is to connect to it.
The remote server runs on Linux. I'm trying to find out how to do this and I came across with JSch. I have not read too much about it but I would like to ask you if this is possible with JSch or what is the solution you would use.
JSch can surely work.
Refer this: File download
I would like to connect with an SFTP client to an FTP server using java. I know the two technologies have nothing to do with each-other. What I'm trying to accomplish is to connect to an FTP server via the internet with out using two ports or changing the server configuration.
Is there any SFTP->FTP bridge in java it would be great. If not, how can I accomplish that ?
I would like to incorporate this in an exciting java server so hence, java based solutions are preferred. If there is some standalone software which you can control via code than it should support windows and *nix.
(Since SFTP is just the means here, a similar WebDav solution will also work)
You could go with trial and error. Try this out see if it works.
How to retrieve a file from a server via SFTP?
for just educational reasons I want to access a remote file from java. To be more specific I want to upload somewhere a file at a remote pc and then make a program in java where I open it and read its content.Is dropbox a good option? Can this be achieved programmaticaly ? My main question is is there any free server or something like this where I can upload the file?
FTP (File Transfer Protocol) might be the simplest solution.
One of many FTP APIs in Java: Apache Commons-Net FTPClient
It is very difficult to code an FTP in Java, i would suggest FTPing it using FileZilla. You will need to have an open Server in the remote PC (configured to FTP, port 21/22) and from there you can enter the remote PC's IP address and open port into FileZilla (after the server is configured). From there you can just drag and drop the file. Let me know if this helps.
I am working on file download functionality.All my files are in Windows server,is there any Library in java which can be used to do SFTP to transfer files from remote windows server to Linux server where my Java app is running?
use JScape's secure FTP library from this link
given you have access to both peers, you can use SSLServerSocketFactory/SSLSocket for the connection on both ends.
Edit:
some basic example on how to establish connection and read/write data: http://stilius.net/java/java_ssl.php
wow, hope you are satisfied with our software :)
thank you,
I am trying to write a program in java to upload some files from my local environment to a remote server. I cannot use FTP because there is no FTP server installed on that instance. Also port 22 is closed so I can't use scp either.
Is there any other way to approach this?
Thanks in advance guys!
You need something on the serverside, a program, which is waiting for your file. You can't just send something there.
An open port is always a program running, waiting for a connect.
So a couple of possible protocols are rsync and WebDav. But at the end of the day I recommend one of two options. Get ssh installed, or use rsync.
Talk to the unix admin and work something out.
Even linux servers sometimes use smb/cifs (the Microsoft technique to share files and folders) to publish data. The samba team provides a 100% Java library to access those: http://jcifs.samba.org/