Maven build with Java: How to execute script located in resources?
The maven path for all the artifacts is not the same that gets generated when you run it or export the project. You can check this by exporting the project as Jar/War/Ear file and viewing it via winRAR or any other tool.
The resources should be in jar parallel to com directory if its a jar project, but you can double check it.
I am building my Java project with Maven and I have a script file that ends up in the target/classes/resources folder. While I can access the file itself via this.getClass.getResource("/lookUpScript.py").getPath(), I cannot execute a shell command with "." + this.getClass.getResource("/lookUpScript.py").getPath(); this ultimately ends up being ./lookUpScript.py. To execute the shell command I am using a method that is part of my company's code that I can get to work fine with any command not involving a file. Is there a standard way of accessing files located in the resources area of a Maven build that may fix this?