I need to run a shell script at runtime from a WAR that I am running on Tomcat.
So I put my script theScript.sh in the src / main / resources directory (because, yes, I use Maven). This directory is on the class path, I checked it.
In the code, I want to copy my script to the temp directory. So I tried to get it through my ClassLoader:
URL myURL = ClassLoader.getSystemResource("theScript.sh");
if (myURL == null) {
LOG.error("Couldn't find the resource");
}
And guess what? Yes, "Could not find a resource" continues to appear everywhere in my magazines.
Any idea what I'm doing wrong here?
My environment is a traditional Eclipse / Tomcat thing.
source
share