c'est le code que j'ai trouvé sur Internet pour lire les lignes d'un fichier et aussi j'utilise eclipse et j'ai passé le nom de fichiers comme SanShin.txt dans son champ d'argument. mais il imprimera:Passer un fichier comme un argument de ligne de commande et lire ses lignes
Error: textfile.txt (The system cannot find the file specified)
code:
public class Zip {
public static void main(String[] args){
try{
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("textfile.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
}
//Close the input stream
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
s'il vous plaît aidez-moi pourquoi il imprime cette erreur. merci
J'ai un tel fichier texte! !! – user472221
aussi c'est l'emplacement de mon projet: C: \ Documents and Settings \ icc \ espace de travail \ Projet Hoffman – user472221
et mon fichier texte est dans le bureau. – user472221