tgrosinger
tgrosinger

Reputation: 2579

Dynamic Class Loading - Java

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

Upvotes: 4

Views: 3460

Answers (4)

Rafia
Rafia

Reputation: 1

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/

Upvotes: 0

tgrosinger
tgrosinger

Reputation: 2579

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

Upvotes: 1

rekaszeru
rekaszeru

Reputation: 19220

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

One good start would be:

Upvotes: 1

Vladimir Dyuzhev
Vladimir Dyuzhev

Reputation: 18336

IO:

File class

Reading Jar:

JarInputStream class

Loading classes, creating instances and calling methods:

ClassLoader class
Class class
Method class

Upvotes: -1

Related Questions