1

I am working with the Floodlight SDN controller, which is a Maven project. I am trying to run a.jar file that I got by using the maven package command. when I try to run the jar using java -jar floodlight.jar, I get this error:

ERROR [n.f.core.Main] Could not read config file: No such file or directory: src/main/resources/floodlightdefault.properties

The problem is that the application looks for floodlightdefault.properties using an absolute path:

src/main/resources/floodlightdefault.properties

This path does not exist in the jar, but the file itself exists (in the root).

What I have done so far: I confirmed that this is the source of the problem by moving the jar to the correct directory in relation to the absolute path, and it ran from there.

My Question: How can I build this Maven project so that it does not use absolute path with the jar? the project's codebase is large and I do not know where this file is being called. but I think the error is on me as I am a beginner.

yusur
  • 21
  • 3
  • If the app is using an absolute path this is simply wrong. A resource should be loaded via `this.getClass().getResourcesAsStream("/...")`... – khmarbaise Apr 13 '22 at 14:21

0 Answers0