You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exception happens in ClasspathConfigurationSource at line 122. The root of the problem seems to be that the java.nio.Path API generates path strings with backslashes when running in Windows (the concrete class of the Path objects is WindowsPath). Which is fine for actual files on the FS, but not fine for:
I have the same problem. The original ClasspathConfigurationSource has seems buggy.
I locally fixed that with my own ClasspathConfigurationSource impl that replace windows backslashas to unix slashas.
Using cfg4j in a client app (JavaFX and Swing).
I have a
ClasspathConfigurationSource
in which I add a path "/config/application.properties".When I start the program from the IDE, everything is fine. But when I build the app JAR and launch the JAR, I get an exception:
java.lang.IllegalStateException: Can't bind method lookAndFeel
The exception happens in
ClasspathConfigurationSource
at line 122. The root of the problem seems to be that thejava.nio.Path
API generates path strings with backslashes when running in Windows (the concrete class of thePath
objects is WindowsPath). Which is fine for actual files on the FS, but not fine for:getClass().getClassLoader().getResourceAsStream(path.toString())
Which then returns null.
My workaround for now will be to place the config file at the root of the classpath, avoiding the problem.
I am not sure what the proper fix should be. Maybe if
getResourceAsStream
returns null, retry after converting all backslashes to forward slashes ?The text was updated successfully, but these errors were encountered: