문자열을 PrintWriter를 사용하여 텍스트 파일에 성공적으로 쓰고 있으며, 기본적으로 출력 텍스트 파일은 내가 작업중인 Eclipse 프로젝트의 디렉토리에 기록됩니다.Printwriter 대상 문제
하지만 내 이클립스 프로젝트는 특정 폴더 내가 텍스트 파일에 기록 할 자료라고했습니다
내 코드는 다음과 같습니다
:protected void saveCommandsToFile() throws FileNotFoundException, IOException {
PrintWriter out = new PrintWriter("commands.txt");
int listsize = list.getModel().getSize();
for (int i=0; i<listsize; i++){
Object item = list.getModel().getElementAt(i);
String command = (String)item;
System.out.println(command); //use console output for comparison
out.println(command);
}
out.close();
}
난에 라인을 변경하는 경우
PrintWriter out = new PrintWriter("/Resources/commands.txt");
FileNotFoundException이 발생합니다. 이 문제를 어떻게 해결할 수 있습니까? 고맙습니다!