int reval = fcCari.showOpenDialog(this);
String sourcePath = fcCari.getSelectedFile().getAbsolutePath();
String targetPath = "C:\\Users\\nadzar\\Downloads\\Compressed\\JavaSQLite\\resource\\";
targetPath += fcCari.getSelectedFile().getName();
if ((reval == JFileChooser.APPROVE_OPTION)) {
File source = new File(sourcePath);
File target = new File(targetPath);
copyFile(source, target);
targetPathFoto=targetPath;
tambahFoto(targetPathFoto);
}
else{
JOptionPane.showMessageDialog(rootPane, "Batal Menambahkan Foto");
tambahFoto(this.targetFoto);
}
System.out.println(targetPathFoto);
내 프로젝트가 이동 한 경우 경로를 변경해야합니다. 프로젝트 디렉토리가 변경되는 동안 대상 경로가 어떻게 변경 될 수 있습니까?자바에서 프로젝트의 동일한 디렉토리에 복사 하시겠습니까?
[this] (http://stackoverflow.com/questions/778187/getting-directory-path-to-class-file-containing-main)와 같은 것? –