KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to get a path to a Resource but I have had no luck. This works (both in IDE and with the JAR) but this way I can't get a path to a file, only the file contents: ClassLoader classLoader = getClass().getClassLoader(); PrintInputStream(classLoader.getResourceAsStream("config/netclient.p")); If I do this: ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("config/netclient.p").getFile()); The result is: java.io.FileNotFoundException: file:/path/to/jarfile/bot.jar!/config/netclient.p (No such file or directory) Is there a way to get a path to a resource file?
Tags (comma-separated)
Save Edits
Cancel