Salut tout le monde,
j'ai un problème avec mon code.
* Tout d'abord j'ai une arborescence comme ça :
appliKNN/src
appliKNN/bin
appliKNN/classes
* Dans /src, j'ai deux fichiers : WordSpace.java et Test.java
** le contenu de mon fichier WordSpace.java est le suivant :
** et mon fichier Test.java contient :
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 import java.io.FileNotFoundException; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.util.List; class WordSpace { private static BufferedReader lecteur = null; private static String training_file = null; private List wsm = null; private int taille = 0; private int dim_max = 0; private int nb_classes = 0; public WordSpace() { } public static void initialiserReader(String tf) throws FileNotFoundException { WordSpace.training_file = tf; try { WordSpace.lecteur = new BufferedReader(new FileReader(WordSpace.training_file)); } catch(FileNotFoundException nf) { System.out.println("Fichier non trouvé !"); } } public void construireWSM() throws IOException { String ligne = null; boolean eof = false; try { while(eof != true) { ligne = WordSpace.lecteur.readLine(); if (ligne != null) { System.out.println(ligne); } } } catch(IOException io) { System.out.println("Erreur de lecture de ligne du fichier !"); } } public static void finalizeReader() throws IOException { try { WordSpace.lecteur.close(); } catch(IOException io) { System.out.println("Erreur de fermeture du fichier !"); } } }
*** quand je compile avec la commande :
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 import java.io.*; class Test { /** * @param args */ public static void main(String[] args) throws FileNotFoundException, IOException { String nomFichier = "/home/mifir2/mrakho/Desktop/stage/data/barrage-datasets/barrage-training1.txt"; WordSpace monWSM = new WordSpace(); //WordSpaceModel.initialiserReader(nomFichier); //monWSM.construireWSM(); WordSpace.finalizeReader(); }
javac -d classes/ Test.java
j'ai le message suivant :
pourriez-vous m'indiquer quelle erreur j'ai commise ?src/Test.java:20: cannot find symbol
symbol : class WordSpace
location: class Test
WordSpace monWSM = new WordSpace();
^
src/Test.java:20: cannot find symbol
symbol : class WordSpace
location: class Test
WordSpace monWSM = new WordSpace();
^
src/Test.java:23: cannot find symbol
symbol : variable WordSpace
location: class Test
WordSpace.finalizeReader();
^
3 errors
je vous en remercie d'avance
Myra
Partager