0

I am working on a program that will allow for modular addons to be installed by simply dropping the correct .jar file into a folder. I was not quite sure how to add a file like this to the build path and use a method from that file. I know how to do this if I know exactly what file I will be using, but in this case I do not. I will need to be able to run a method from the external jar without telling eclipse ahead of time that this is the file I will be using.

Steve Glick
  • 698
  • 7
  • 19
  • If you use Java 7, you can define a directory and load all jars from there when running `java`. Not sure of the correct syntax, you can check it yourself. – SJuan76 May 28 '13 at 22:34
  • Will this work for java 6 as well? I used to compile on Java 7, but I had issues with people saying it doesn't work because they used Java 6. I am willing to switch to Java 7 again if necessary, but I would prefer to stay on Java 6 for now. – Steve Glick May 28 '13 at 22:38

1 Answers1

1

You can load the jar using method described on this answer: How to load a jar file at runtime

I would assume you also need an interface to act as a binding contract so you know what to cast your class to

Community
  • 1
  • 1
gerrytan
  • 40,313
  • 9
  • 84
  • 99