4

I am trying to create a program that will search a specified directory for any other jar files (which I will not know the name of). It will then take the object from that file and create an instance of it that can be referenced later in my program.

I am happy to do the research on how to do this on my own, but do not know what this would be called to even start looking.

Anyone able to point me in the correct direction? Thanks

2
  • 1
    Check out the examples mentioned in this post tutorials.jenkov.com/java-reflection/… Commented Apr 19, 2011 at 20:31
  • I do this in my project right now. Its rather easy using reflection. Check out the links people have been posting. Commented Apr 19, 2011 at 21:15

4 Answers 4

1

You should google up java reflection and read some articles / samples upon it.

One good start would be:

Sign up to request clarification or add additional context in comments.

Comments

1

I actually found a link that has a great example in it that is what helped me get it working the most. Find it Here

Comments

0

I faced problem of loading classes while working on a trading application and found following link useful. http://trading.aurorasolutions.org/reflection-dynamically-loading-classes/

1 Comment

Please add some context for the link.
-1

IO:

File class

Reading Jar:

JarInputStream class

Loading classes, creating instances and calling methods:

ClassLoader class
Class class
Method class

1 Comment

Could you offer a little more explanation with your response?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.