Classe java pour ouvrir un fichier texte

Bonjour,
J'ai besoin d'une classe java pour ouvrir un fichier texte à partir d'un répertoire donné c'est urgent aidez-moi svp
merci d'avance
Configuration: Windows Vista
Safari 532.0

5 réponses

  1. merci slim mais le code devrait me permettre d'ouvrir un fichier à partir d'un répertoire non pas d'afficher son continu par exemple en lui indiquant c:\fichier.txt le fichier texte fichier.txt s'ouvre
    0
    1. tu peux essayer cela
      Process p = Runtime.getRuntime().exec("notepad.exe c:\\temp\\test.txt");//mon fichier s'appelle test.txt
      @+
      0
      1. Merci chuka j'ai besoin exactement de celà mais lorsque je l'ai essayé il a générer un erreur voilà ce que j'ai fait:

        public class Ouvrir{

        Process p = Runtime.getRuntime().exec("notepad.exe c:\\o.txt");//mon fichier s'appelle test.txt

        }
        pouvez-vous m'aider? merci d'avance
        0
    2. salut,
      import java.io.IOException;
      public class Main {
      public static void main(String[]args) throws IOException{

      Ouvrir ov=new Ouvrir("notepad.exe","c:\\temp\\test.txt");
      ov.launchExe();

      }
      }
      class Ouvrir
      {
      String path;
      String Exe;
      public Ouvrir(String Exe,String Path)
      {
      this.path=Path;
      this.Exe=Exe;

      }
      public void launchExe() throws IOException
      {
      Runtime.getRuntime().exec(Exe+" "+path);

      }
      }
      J'espere ca pourra t'aider!!
      @+
      0
      1. merci beaucouuuuuuuuuuuuuuuuuuuup
        ça marche parfaitement !
        0
    3. slt je veus une class java pour ouvrir un fichier texte sous l'interfece java
      0