Figuring out path to resources in built jar
Im currently doing this to read my shader files:
and it works when just testing in intellij, but if i build the jar it no longer works as the src/main/resources part of the path doesnt exist. Any solutions?
4 Replies
ā
This post has been reserved for your question.
Hey @špothicon! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
You should access it as a resource insstead
In a JAR, there is no src/main/resources
You can do
getClass().getClassLoader().getResource("assets/base/shaders/scene.vert")
alr im doing that now and it is getting the correct path
however it gives a NoSuchFileException when i attempt to use that path to read the file
can you not read files that are inside jars?
i figured out a solution:
Post Closed
This post has been closed by <@465515365108154380>.