0

Springboot app works fine form the IDE. Here is the code in my controller.

var resource = ResourceUtils.getURL("classpath:suitexmls/"+AppProperty.TEST_SUITE_NAME);
TestNG testng = new TestNG();
final String suitePath = resource.getPath();
List<String> xmlList = new ArrayList<>();
xmlList.add(suitePath);
testng.setTestSuites(xmlList);
testng.run(); 

It works fine form the IDE.

But when I build the jar file and tried to excute as standalone jar file as

java -jar myapp.jar

I got this error: java.io.FileNotFoundException: C:\dev\ToolKit-API\target\Toolkit-0.0.3.jar!\BOOT-INF\classes!\suitexmls\TestSuite.xml (The system cannot find the path specified)

How can I refercee to \suitexmls\TestSuite.xml which is in my reseoruc folder when executing from standalone jar file?

Masi Boo
  • 410
  • 5
  • 15
  • Does this answer your question? [Classpath resource not found when running as jar](https://stackoverflow.com/questions/25869428/classpath-resource-not-found-when-running-as-jar) – dekkard May 12 '22 at 21:11

0 Answers0