import java.awt.*; import java.io.*; public class Ecriture { public static void ecrireFichier() { try { BufferedWriter flux = new BufferedWriter(new FileWriter("Texte.txt", true)); try { String aEcrire = "Hello world!"; flux.write(aEcrire, 0, aEcrire.length()); flux.newLine(); try { flux.close(); } catch (IOException e3) { System.err.println("Erreur de fermeture."); } } catch (IOException e2) { System.err.println("Erreur d'écriture."); } } catch (IOException e1) { System.err.println("Erreur d'ouverture."); } } public static void main(String[] args) { while (true) { Ecriture.ecrireFichier(); System.out.println("Fichier modifié."); try { Thread.sleep(5000); } catch (InterruptedException e4) { System.err.println("Erreur de timer."); } } } }