이것은 인터넷에서 파일의 행을 읽었을 때 발견 한 코드이며 이클립스를 사용하고 SanShin.txt로 파일 이름을 전달했습니다. 그것의 인수 필드. 하지만 인쇄됩니다 :파일을 명령 줄 인수로 전달하고 해당 줄을 읽습니다.
Error: textfile.txt (The system cannot find the file specified)
코드 :이 오류를 인쇄하는 이유
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());
}
}
}
저를 도와주세요. 감사합니다.
나는 그런 텍스트 파일을 가지고! !! !! – user472221
이것은 내 프로젝트의 위치입니다. C : \ Documents and Settings \ icc \ workspace \ Hoffman Project – user472221
내 텍스트 파일은 바탕 화면에 있습니다. – user472221