Java FileOutputStream: path relative to program folder
Below is the syntax you can use to retrieve relative file path of a class file in java
FileOutputStream out =new FileOutputStream(new File(ClassName.class.getProtectionDomain().getCodeSource().getLocation().getPath()+"/filename"));
No comments:
Post a Comment