I have hibernate.cfg.xml and test.txt in the path which i read by java program. Now when i created the jar using maven those files were not present. So i read that i should put in the resources folder , so now my directory structure is
scr -> main-> java
->resources
Now i can see the files in the jar but they are not inside resource folder
it bascically
myjar.jar -> com (source code)
-> META -INF
-> hibernate.cfg.xml
-> test.txt
I tried accessing using
getClass().getResourceAsStream("test.txt")
but got null..
Let me know what steps are wrong ?
解决方案
Looking at this article, Does getClass().getResourceAsStream("/test.txt") make a difference?