ERROR (.sql) Resource not found

Answered

I have recently switched to using Intellij from Eclipse and have found the transition to be quite good except for this one error....

I am running a Java application which does some stuff then runs a number of SQL scripts. While there was no problem in Eclipse, Intellij can't seem to find the SQL scripts to run.

The files are located in a folder which is marked as the Resource Root directory. When the project is built, the files appear in the target folder. What am I missing?

0
3 comments

What code do you use to load the files from the classpath? Where exactly do they appear under target? Is that a Maven project?

0
Avatar
Permanently deleted user

Yes, it is a Maven project. We call to the following method to load the files:

java.lang.ClassLoader#getSystemResourceAsStream()

and the files appear in the same relative path within the target/classes folder

 

0

A sample project would help to find the problem: https://stackoverflow.com/help/mcve.

0

Please sign in to leave a comment.