Exception in thread "main" java.lang.Error: Unresolved compilati
siananox
-
KX Messages postés 19031 Statut Modérateur -
KX Messages postés 19031 Statut Modérateur -
Bonjour,
Je suis en train d'écrire un code en Java pour lemmatiser un texte contenu dans un fichier xml, je n'ai pas d'erreur à part ce message :
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method printIn(String) is undefined for the type PrintStream
Annotation cannot be resolved to a variable
Cannot instantiate the type Annotation
Et voici mon code :
Pouvez-vous m'aider et me dire où est le problème?
Merci !!!
Je suis en train d'écrire un code en Java pour lemmatiser un texte contenu dans un fichier xml, je n'ai pas d'erreur à part ce message :
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method printIn(String) is undefined for the type PrintStream
Annotation cannot be resolved to a variable
Cannot instantiate the type Annotation
Et voici mon code :
package texte1.projet.defi;
import java.io.*;
import java.util.Properties;
import edu.stanford.nlp.io.*;
import edu.stanford.nlp.ling.*;
import edu.stanford.nlp.pipeline.*;
import edu.stanford.nlp.trees.*;
import edu.stanford.nlp.util.*;
import java.lang.annotation.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class First {
private static final int ProjetDEFI = 0;
private static final int Desktop = 0;
private static int workspace;
private Object output2;
public static void main(String[] args) throws IOException {
PrintWriter out;
out = new PrintWriter("Users/anaisnef/Desktop/ProjetDEFI/workspace/output.txt");
Properties props=new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma");
StanfordCoreNLP pipeline= new StanfordCoreNLP(props);
Annotation annotation;
String readString = null;
PrintWriter pw = null;
BufferedReader br = null;
br = new BufferedReader (new FileReader ("Users/anaisnef/Desktop/livre1.xml"));
int anaisnef;
int Users;
pw = new PrintWriter (new BufferedWriter (new FileWriter ("Users/anaisnef/Desktop/ProjetDEFI/workspace/output2.txt")));
String x = null;
while ((readString= br.readLine()) !=null) {
pw.println (readString); String xx=readString;x=xx;System.out.printIn("OKKKK");
Annotation = new Annotation(x);
pipeline.annotate(annotation);
pipeline.prettyPrint(annotation, out);
}
br.close();
pw.close();
System.out.println("Done...");
}
}
Pouvez-vous m'aider et me dire où est le problème?
Merci !!!
A voir également:
- String cannot be resolved to a type
- In da place - Forum Mail
- Aux in ✓ - Forum Enceintes / HiFi
- Navigation in private - Guide
- Dc in - Forum Disque dur / SSD
- Peut-on brancher un casque sur une prise auxiliaire ? - Forum Casque et écouteurs
2 réponses
Bonjour,
Avant d'exécuter ton programme tu dois le compiler - sans erreur - or si tu as cette erreur c'est à l'exécution d'un programme non compilable.
L'erreur est sur
Avant d'exécuter ton programme tu dois le compiler - sans erreur - or si tu as cette erreur c'est à l'exécution d'un programme non compilable.
L'erreur est sur
System.out.printInavec un i majuscule alors que tu devrais avoir
System.out.printlnavec un L minuscule ("LN" pour Line)
Il m'indique ça
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type Annotation is ambiguous
Annotation cannot be resolved to a variable
The type Annotation is ambiguous
at AMF1.AMF1.main(AMF1.java:27)
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type Annotation is ambiguous
Annotation cannot be resolved to a variable
The type Annotation is ambiguous
at AMF1.AMF1.main(AMF1.java:27)
Enlèves tout tes import et mets ceci :
Remarque : tu devras aussi remplacer
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Properties; import edu.stanford.nlp.pipeline.Annotation; import edu.stanford.nlp.pipeline.StanfordCoreNLP;
Remarque : tu devras aussi remplacer
Annotation = new Annotation(x);par
annotation = new Annotation(x);...
Merci ! Mais j'ai tjrs le même soucis au niveau des lignes "Annotation" !
Bonne journée :)