4thex
4thex

Reputation: 1166

Intellij resource subfolder not included in classpath

I am trying to load a resource using ClassLoader.getResourceAsStream in a JUnit test in Intellij, and it is not found if the resource is in a subfolder. It is found fine in the root of the test resources folder. I am using the correct replace-dots-with-slash notation.-

This is different from the question asked here because I realized I had added a slash in the beginning of the resource path.

Upvotes: 5

Views: 1996

Answers (1)

4thex
4thex

Reputation: 1166

The resource path must not start with a slash.

Upvotes: 1

Related Questions