bnj à tous,
je voudrais executer un code java avec l'utilisation de jdom
j'ai intéger dans mon projet les jars:jdom4.Xcerces"projet,proprités,buildpath,add external jars,mais qd j'écrit mon code il m'affiche:

the import org.jdom can not be resolved
voici le code


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
import java.io.*;
import org.jdom.*;
import org.jdom.output.*;
 
public class JDOM1
{
   //Nous allons commencer notre arborescence en créant la racine XML
   //qui sera ici "personnes".
   static Element racine = new Element("personnes");
 
   //On crée un nouveau Document JDOM basé sur la racine que l'on vient de créer
   static org.jdom.Document document = new Document(racine);
public static void main(String[] args)
   {
      Element etudiant = new Element("etudiant");
      racine.addContent(etudiant);
      Attribute classe = new Attribute("classe","P2");
      etudiant.setAttribute(classe);
      Element nom = new Element("nom");
      nom.setText("CynO");
      etudiant.addContent(nom);
      affiche();
      enregistre("Exercice1.xml");
   }
 
   static void affiche()
   {
      try 
      {
         XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
         sortie.output(document, System.out);
      }
      catch (java.io.IOException e){}
   }
 
   static void enregistre(String fichier)
   {
      try
      {
         XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
         sortie.output(document, new FileOutputStream(fichier));
      }
 
}
et quand je fais "run as java application" il m'affiche:

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Element cannot be resolved to a type
Element cannot be resolved to a type
racine cannot be resolved
Attribute cannot be resolved to a type
Attribute cannot be resolved to a type
Element cannot be resolved to a type
Element cannot be resolved to a type

at package1.JDOM1.main(JDOM1.java:20)
que faire? merci a++