Salut la communauté,
Je travail sur une application en rmi. A partir d'une interface graphique je recupere les info qui seront envoyé vers un serveur et serviront à creer des fichiers .
J'ai creer deux paquetages: frame qui contient le code de l'interface graphique et la classe Iclient.serveur qui contient la classe Client et IClientImpl
Client.java
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
package serveur;
 
public class Client implements java.io.Serializable {
 
	private String nom,prenom,adresse,canal;
    private int jour,mois,annee,heure,minute;
    private double tel;
	public Client(String prenom,String nom,String adresse,double tel,int jour,int mois,int annee,int heure,int minute,String canal) 
	{
		this.prenom=prenom;
		this.nom=nom;
		this.adresse=adresse;
		this.tel=tel;
		this.jour=jour;
		this.mois=mois;
		this.annee=annee;
		this.heure=heure;
		this.minute=minute;
		this.canal=canal;
	}
 
 
	 public String getNom()
	 {
		 return nom;
	 }
 
	 public String getPrenom()
	 {
		 return prenom;
	 }
 
	 public String getAdresse()
	 {
		 return adresse;
	 }
 
	 public String getCanal()
	 {
		 return canal;
	 }
 
	 public double getTel()
	 {
		 return tel;
	 }
 
	 public int getJour()
	 {
		 return jour;
	 }
 
	 public int getMois()
	 {
		 return mois;
	 }
 
	 public int getAnnee()
	 {
		 return annee;
	 }
 
	 public int getHeure()
	 {
		 return heure;
	 }
 
	 public int getMinute()
	 {
		 return minute;
	 }
	public static void main(String[] args) {
 
 
	}
 
}
IClientImpl.java
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
 
package serveur;
import java.io.*;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import java.sql.*;
 
import java.util.*;
import java.util.Date;
 
import javax.swing.JOptionPane;
 
import client.ICompte;
 
public class ICompteImpl extends UnicastRemoteObject implements ICompte{
 
	/**
         * @param args
         */
	//static Hashtable comptes=Compte.getHashtable();
	boolean creer,trouve;
	Connection connex;
 
	String sep = File.separator ;
	Compte c;
	public ICompteImpl()throws RemoteException{
		super();
	}
	public boolean creerCompte(String nom,String prenom,double solde,double decouvert,String numero,String type)throws RemoteException{
		System.setSecurityManager(new RMISecurityManager());
		c=new Compte(nom,prenom,solde,decouvert,numero,type);
		//creation fichier indiv
		File fic = new File ("C:"+sep+"rmi"+sep+"rmi2"+sep+"clients"+sep+"client"+c.getNumeroCompte()+".txt");
			try {
			if(!fic.exists()){
		creer=fic.createNewFile ( );
		}else{
			JOptionPane.showMessageDialog (null,"Ce compte existe d�ja!","Message d'alerte",
					JOptionPane.INFORMATION_MESSAGE, null);
		}
		}
		catch ( IOException ex)
		{ex.printStackTrace() ;}
 
		//ecriture dan le fic indiv
 
		try {
			Date date=new Date();
			// TODO Auto-generated catch block
	     	FileWriter fw=new FileWriter(fic,true);
			BufferedWriter bw = new BufferedWriter(fw);
			bw.write("         HISTORIQUE DU COMPTE N�: "+numero+"\n");
			bw.write("\n");
			bw.write("DATE D'OUVERTURE : "+date+"\n");
			bw.write("Nom titulaire : "+nom+"\n");
			bw.write("Prenom titulaire : "+prenom+"\n");
			bw.write("Solde : "+solde+"\n");
			bw.write("Decouvert : "+decouvert+"\n");
			bw.write("Numero : "+numero+"\n");
			bw.write("Type de compte : "+type+"\n");
			bw.newLine();
        	bw.close();
			fw.close();
		}
		catch(IOException e2){}
 
		//fichier commun
		File fic2 = new File ("C:"+sep+"rmi"+sep+"rmi2"+sep+"clients"+sep+"clientbin"+c.getNumeroCompte()+".txt");
 
			try {
			if(!fic2.exists()){
		creer=fic2.createNewFile ( );
		}
			FileOutputStream fos=new FileOutputStream(fic2);
			ObjectOutputStream oos= new ObjectOutputStream(fos);
			oos.writeObject(c);
		}
		catch ( IOException ex)
		{ex.printStackTrace() ;}
 
 
//connexion bd
 
		try
	    {  
 
		  Class.forName("org.gjt.mm.mysql.Driver");	
 
	    }
	    catch(ClassNotFoundException e){}
 
	    try
	    {
	    connex = DriverManager.getConnection ("jdbc:mysql://localhost/banque","root","");
 
	    }
 
	    catch (SQLException e) {}
 
	    try
	    {   
 
	    	Statement st1=connex.createStatement();
	    	int i=st1.executeUpdate("insert into `clients` values('"+nom+"','"+prenom+"','"+numero+"')");
	    	int t =st1.executeUpdate("insert into `compte` values('"+numero+"','"+type+"',"+solde+","+decouvert+")");
 
	    	st1.close();
	    	connex.close();
	    }
	    catch(SQLException sql){sql.getMessage();}
 
		return creer;
	}
    public boolean retrait(String numero,double montant)throws RemoteException{
 
    	File fic2 = new File ("C:"+sep+"rmi"+sep+"rmi2"+sep+"clients"+sep+"clientbin"+numero+".txt");
    	File fic = new File ("C:"+sep+"rmi"+sep+"rmi2"+sep+"clients"+sep+"client"+numero+".txt");
			trouve=fic2.exists();
 
 
 
 
				try{
					FileInputStream fis=new FileInputStream(fic2);
					ObjectInputStream ois= new ObjectInputStream(fis);
					c=(Compte)ois.readObject();
 
					c.debiter(montant);
 
					//completer le fichier indiv
					FileWriter fw=new FileWriter(fic,true);
					BufferedWriter bw= new BufferedWriter(fw);
					bw.write("Nouvelle op�ration sur le compte");
					bw.write("\n");
					bw.write("Retrait de: "+montant+" Francs CFA");
					bw.write("\n");
					bw.write("Solde actuel : "+c.getSolde()+" Francs CFA");
					bw.write("\n");
 
					bw.close();
					fw.close();
					ois.close();
					fis.close();
 
					//reecrire dans le fichier binaire
					FileOutputStream fos=new FileOutputStream(fic2);
					ObjectOutputStream oos= new ObjectOutputStream(fos);
					oos.writeObject(c);
 
				}
 
					catch(IOException e2){} 
					catch (ClassNotFoundException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} 
 
					//con bd
					try
				    {  
 
					  Class.forName("org.gjt.mm.mysql.Driver");	
 
				    }
				    catch(ClassNotFoundException e){}
 
				    try
				    {
				    connex = DriverManager.getConnection ("jdbc:mysql://localhost/banque","root","");
 
				    }
 
				    catch (SQLException e) {}
 
				    try
				    {   
 
				    	double solde =c.getSolde() ;
 
				    	Statement st1=connex.createStatement();
 
				    	int p=st1.executeUpdate("update `compte` set solde="+solde+" where numc='"+numero+"'");
 
 
 
 
				    	st1.close();
 
				    	connex.close();
				    }
				    catch(SQLException sql){sql.getMessage();}
 
 
		return trouve;			
 
    }
    public boolean depot(String numero,double montant)throws RemoteException{
    	File fic = new File ("C:"+sep+"rmi"+sep+"rmi2"+sep+"clients"+sep+"client"+numero+".txt");
    	try{fic.createNewFile();
 
    	}catch(IOException io){}
    	File fic2 = new File ("C:"+sep+"rmi"+sep+"rmi2"+sep+"clients"+sep+"clientbin"+numero+".txt");
			trouve=fic.exists();
 
				try{
					FileInputStream fis=new FileInputStream(fic2);
					ObjectInputStream ois= new ObjectInputStream(fis);
					c=(Compte)ois.readObject();
 
					c.crediter(montant);
 
					//completer le fichier indiv
					FileWriter fw=new FileWriter(fic,true);
					BufferedWriter bw= new BufferedWriter(fw);
 
					bw.write("Nouvelle op�ration sur le compte");
					bw.write("\n");
					bw.write("Depot de: "+montant+"Francs CFA");
					bw.write("\n");
					bw.write("Solde actuel : "+c.getSolde()+"Francs CFA \n");
					bw.write("\n");
					ois.close();
					fis.close();
					bw.close();
					fw.close();
					//reecrire dans le fichier binaire
					FileOutputStream fos=new FileOutputStream(fic2);
					ObjectOutputStream oos= new ObjectOutputStream(fos);
					oos.writeObject(c);
					oos.close();
					fos.close();
 
				}
 
					catch(IOException e2){} 
					catch (ClassNotFoundException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} 
//					con bd
					try
				    {  
 
					  Class.forName("org.gjt.mm.mysql.Driver");	
 
				    }
				    catch(ClassNotFoundException e){}
 
				    try
				    {
				    connex = DriverManager.getConnection ("jdbc:mysql://localhost/banque","root","");
 
				    }
 
				    catch (SQLException e) {}
 
				    try
				    {   
				    	double solde=c.getSolde();   	
				    	Statement st1=connex.createStatement();
 
				    	int p=st1.executeUpdate("update `compte` set solde="+solde+" where numc='"+numero+"'");
 
 
 
				    	st1.close();
 
				    	connex.close();
				    }
				    catch(SQLException sql){sql.getMessage();}
 
    return trouve;
    }
    public File getHistorique(String numero)throws RemoteException{
 
    	File fic = new File ("C:"+sep+"rmi"+sep+"rmi2"+sep+"clients"+sep+"client"+numero+".txt");
 
			return fic;		
 
    }
	public static void main(String[] args) {
		// TODO Auto-generated method stub
 
	}
 
}
Lorsque je compile le systeme indique cette erreur dans la classe IClientImpl sur "Client c;" Cannot not be resolved to a type

Franchement je ne sais pas à quoi est du cette erreur.
Merci davance pour votre aide