-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot load resource #425
Comments
gradle has nothing to do with the way how classes are loaded from jars. You can easily debug classloading. in your particular case, you're trying to use classloader of Thread class for loading plugin-specific file. It's not allowed, you can access only to your plugin's classes. Just use your own class-loader: |
Hey, thanks for the clarification and your answer. Unfortunately, this code comes from a third party library and was simplified by myself. Is there any other way, you can think of, so that i can make this code working? |
I don't think so. You can try to read your class/resources using plugin's classloader and then try to load your class/resource to root class-loader. Not sure it's possible, though. |
For anyone experiencing the same problem. I solved it by using the using the Classloader of the thirdparty class containing the code above and setting it on the current thread. Something like the following:
|
I have a solution! I hope I'm not too late =) |
Hey,
is there anything i am missing in loading a custom resource file (simple .properties file).
The project layout is like the following:
I am trying to load the file my.properties using the following code:
However the resourceStream is always null. I also tried to copy the file into the libs folder and tried to add the file manually to the classpath. Unfortunately both did not work.
As far as a i know gradle, everything from the resource directory should be accessible on the classpath, shouldn't it?
The Project can be found here, it is based on the official getting started tutorial:
https://github.com/oemergenc/simple-intellij-plugin
The text was updated successfully, but these errors were encountered: