Share Views Share Knowledge
get relative file path for class file in java
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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment