I am working on a Maven project and I would like to access the resources
folder that contains an executable: geckodriver.exe
Path: src/main/resources/geckodriver/
I know after packaging, the is copied in target
. Therefore, the file should be accessible via classpath
. Then I should be able to access the file by writing this: MyClass.class.getClassLoader().getResource("geckodriver/geckodriver.exe")
.
An exception is displayed when I run the project: java.lang.IllegalStateException: The driver executable does not exist
Is there a way to fix this ?