Bonjour,
Je suis actuellement entrain de réaliser un petit client FTP basé sur la classe FTPconnection.java. cependant je dois absolument passé par le proxy de mon entreprise pour accéder au serveur FTP. J'ai fais plusieurs recherche et j'ai trouvé ceci afin d'arriver à mon objectif :
Le problème est que c'as ne marche pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 System.getProperties().put("ftpProxySet", "true"); System.getProperties().put("ftpProxyHost", "13.168.1.20"); System.getProperties().put("ftpProxyPort", "5658");
Voici mon code au complet :
Quelqu'un pourrai t'il m'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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 import java.io.*; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Copy { public static void main(String[] args) throws IOException { FileWriter out = new FileWriter("Raising.log"); FtpConnection clientFtp = new FtpConnection(true,1); Date D = new Date(); DateFormat Datefile = new SimpleDateFormat("ddMMyyyy" ); DateFormat Datelog = new SimpleDateFormat("dd-MM-yyyy HH:mm" ); try { System.getProperties().put("ftpProxySet", "true"); System.getProperties().put("ftpProxyHost", "99999"); System.getProperties().put("ftpProxyPort", "9999"); //Runtime r = Runtime.getRuntime(); //Process p = r.exec("C:\\testjava\\importimport.bat"); //p.waitFor(); if(clientFtp.connect("adressre ip du serveur ftp",21)) { out.write(" connexion réussi"); if(clientFtp.login("user", "PWD")) { clientFtp.makeDirectory("dossier du "+Datefile.format(D)); clientFtp.changeDirectory("dossier du "+Datefile.format(D)); if (clientFtp.uploadFile("Report.csv","c:\\testjava\\Report.csv")) { out.write(" chargement : succés");} else {out.write(" chargement : échec");} } else{out.write(" FTP : "+Datelog.format(D)+" échec de la connexion avec les informations d'identification\n");} clientFtp.logout(); }else { out.write(" ops !!! "); } }catch (IOException e) { System.err.println("=====."+e); out.write(" FTP : "+Datelog.format(D)+" "+e); } catch (Exception b) {out.write("il y a un problème avec la runmacro"+b);} clientFtp.disconnect(); out.close(); } }
Partager