Skip to content

Instantly share code, notes, and snippets.

@gdouzwt
Last active September 12, 2020 15:02
Show Gist options
  • Save gdouzwt/57f6dfdf96138a7b41802b190529b3dd to your computer and use it in GitHub Desktop.
Save gdouzwt/57f6dfdf96138a7b41802b190529b3dd to your computer and use it in GitHub Desktop.
Get absolute path to file in /resources folder
URL res = getClass().getClassLoader().getResource("abc.txt");
File file = Paths.get(res.toURI()).toFile();
String absolutePath = file.getAbsolutePath();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment