Bonjour,
je souhaite récupérer un fichier sur un FTP, mais j'ai une erreur sur la fonction download ("permission require")
je n'arrive pas a la résoudre vu que en passant par Firefox je récupère le fichier sans problème.
Peut être je m'y prends mal, donc est-ce la bonne méthode ?
Ou connaissez-vous un serveur FTP (autre que e-nautia) pour y stocker des fichiers et les récupérer par un programme java ?
j'utilise la librairie ftp4j-1.6.1.jar
merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 FTPClient client = new FTPClient(); try { client.connect("e-nautia.com"); client.login("login", "mdp"); client.setType(FTPClient.TYPE_BINARY); client.download("e-nautia.com/maj.xml", new java.io.File("\\Chemin du dossier\\maj.xml")); client.logout(); } catch (Exception e) { e.printStackTrace(); }
Bonne journée
edit:
petite précision concernant le message de retour:
(je ne sais pas si sa peut aider)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 java.net.SocketException: Permission denied: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:150) at java.net.SocketInputStream.read(SocketInputStream.java:121) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177) at sun.nio.cs.StreamDecoder.read0(StreamDecoder.java:126) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:112) at java.io.InputStreamReader.read(InputStreamReader.java:168) at it.sauronsoftware.ftp4j.NVTASCIIReader.readLine(NVTASCIIReader.java:105) at it.sauronsoftware.ftp4j.FTPCommunicationChannel.read(FTPCommunicationChannel.java:142) at it.sauronsoftware.ftp4j.FTPCommunicationChannel.readFTPReply(FTPCommunicationChannel.java:187) at it.sauronsoftware.ftp4j.FTPClient.openPassiveDataTransferChannel(FTPClient.java:3534) at it.sauronsoftware.ftp4j.FTPClient.openDataTransferChannel(FTPClient.java:3468) at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3297) at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3208) at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3073) at ftp.RecupVersion.recup(RecupVersion.java:27) at Main.main(Main.java:29)
Partager