Reputation: 2639
I imported a resource (resource being a GZIP file) into my Java project, but I'm not sure how I could access it from within the same project.
Java Resources -> srctest -> somepackagename -> MyClass.java (This is the class that wants to access the GZIP file)
Java Resources -> testdata -> someFile.gz
Upvotes: 0
Views: 1712
Reputation: 7523
Have you tried this -
InputSteam is = this.getClass().getClassLoader().getResourceAsStream("resources/someFile.gz")
I am assuming the gzip file is on the same classpath as the current class.
Upvotes: 1