Erreur problem sur ficher pouvez vous m'aider
malek2212
Messages postés
23
Statut
Membre
-
KX Messages postés 19031 Statut Modérateur -
KX Messages postés 19031 Statut Modérateur -
Bonjour,
j'ai un problem sur un fichier
j'ai utilese la class Path et une liste pour mettre les chaque lign de ficher dans la liste
mais j'ai un problem que je n'ai pas comprais
Exception in thread "main" java.nio.file.NoSuchFileException: fileTest.txt
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
at java.nio.file.Files.newByteChannel(Unknown Source)
at java.nio.file.Files.newByteChannel(Unknown Source)
at java.nio.file.spi.FileSystemProvider.newInputStream(Unknown Source)
at java.nio.file.Files.newInputStream(Unknown Source)
at java.nio.file.Files.newBufferedReader(Unknown Source)
at java.nio.file.Files.readAllLines(Unknown Source)
at java.nio.file.Files.readAllLines(Unknown Source)
at paths.tpfile.main(tpfile.java:14)
et voila mon code
package paths;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
public class tpfile {
public static void main(String args[]) throws IOException
{
Path p=Paths.get("fileTest.txt");
List<String> lines=Files.readAllLines(p);
}
}
merci
j'ai un problem sur un fichier
j'ai utilese la class Path et une liste pour mettre les chaque lign de ficher dans la liste
mais j'ai un problem que je n'ai pas comprais
Exception in thread "main" java.nio.file.NoSuchFileException: fileTest.txt
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
at java.nio.file.Files.newByteChannel(Unknown Source)
at java.nio.file.Files.newByteChannel(Unknown Source)
at java.nio.file.spi.FileSystemProvider.newInputStream(Unknown Source)
at java.nio.file.Files.newInputStream(Unknown Source)
at java.nio.file.Files.newBufferedReader(Unknown Source)
at java.nio.file.Files.readAllLines(Unknown Source)
at java.nio.file.Files.readAllLines(Unknown Source)
at paths.tpfile.main(tpfile.java:14)
et voila mon code
package paths;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
public class tpfile {
public static void main(String args[]) throws IOException
{
Path p=Paths.get("fileTest.txt");
List<String> lines=Files.readAllLines(p);
}
}
merci
A voir également:
- Erreur problem sur ficher pouvez vous m'aider
- Erreur 0x80070643 - Accueil - Windows
- Erreur 4101 france tv - Forum Lecteurs et supports vidéo
- Erreur 4201 france tv ✓ - Forum Réseaux sociaux
- Code erreur f3500-31 ✓ - Forum Bbox Bouygues
- J'aime par erreur facebook notification - Forum Facebook
1 réponse
Bonjour,
Le message d'erreur est clair "NoSuchFileException: fileTest.txt"
Java n'a pas trouvé ton fichier...
Peut-être parce qu'il ne cherche pas le fichier au bon endroit.
Par défaut le répertoire est résolu en chemin relatif, affiches le en chemin absolu pour voir où il va le chercher.
Le message d'erreur est clair "NoSuchFileException: fileTest.txt"
Java n'a pas trouvé ton fichier...
Peut-être parce qu'il ne cherche pas le fichier au bon endroit.
Par défaut le répertoire est résolu en chemin relatif, affiches le en chemin absolu pour voir où il va le chercher.
System.out.println(p.toAbsolutePath());