I’ve followed a tutorial on how to do a very very basic plugin system and already started adding more things.
But as it turns out, I simply can’t seem to find the right directory to put the plugin in.
I’m using a ServiceLoader for the plugin system, and the jar of the plugin has the services folder with the needed file in it.
Any ideas on how to fix this?
Is this related to JME code at all or should this be asked on the forum for the service loader?
Actually its a Java feature - but not really jME related, true. Maybe ask in a generic java forum.
Oh, that SerivceLoader… yeah, this isn’t really a java trouble shooting forum. Maybe ask where ever you saw the tutorial.
But really “on the classpath” is the answer you are looking for… and if that’s confusing… see above.
First of all, thanks for the answers.
But I thoght I’d ask here because when I let the URLClassLoader print out every path it resulted in the JME user dir (.jme3), my workspace or where the jar was located and one other.
What URLClassLoader? Did you just instantiate one to print stuff from? (That’s not going to mean anything to the running application.)
If you are using the SDK, add a directory the project’s dependencies. Put your jar in there.
But really, general Java questions should be asked on general Java forums. If the JME forum became a Java forum then it would easily overwhelm the questions that actually belong here.
No, the system class loader.
I did that with the directory, but it’s still not recognising the jar.
When I add it as library, everything works.
And, ok, I’ll post general java questions somewhere else in the future.
Yeah, my bad… I was tired or something.
The actual jar has to be on the classpath. Having a directory on the classpath only works if you have resources or actual .class files.
If you want a general directory where users can plop any old jar without editing a classpatht then you will have to instantiate your own classloader for that.
Yeah, no problem.
We’re all just humans.
And you’re also right.
EDIT: Well, it seems to be quite difficult after all…
In the danger of angering you( ):
What classloader should I initialize?
I’m sorry, google didn’t give me any really useful results in the end and there aren’t many other people I could ask.
He said “instantiate”, not "initialize. Googling “use own classloader” gave me plenty results.
Thanks a lot!
I’ve done it now!