How to select the class from a set of jars?

G

George

Hello,

I am developing a "plug-in" type package for an application server.
I have no control on the classpath, which includes many version of the same
class in many jars.
Unfortunately, the older version comes first, and what I need is the newer
version, which comes later.
As I know, the JVM always use the first one on the path.
Has any way to specifically choose the later one from my code?
Thanks in advance for any help.

regard,
George
 
J

jessu

You may have to write custom ClassLoader to achieve that behaviour. Is
that possible in your scenario?
 
R

Roedy Green

As I know, the JVM always use the first one on the path.
Has any way to specifically choose the later one from my code?
Thanks in advance for any help.

I suppose you can create a new set of jars by writing a utility to
pick through what you have and create the desired set of classes and
jar them.
 
G

George

yes, i could create a new jar, but the difficuty is i have no control on the
class loading sequence at runtime.
 
R

Roedy Green

yes, i could create a new jar, but the difficuty is i have no control on the
class loading sequence at runtime.

I don't understand just what is tying your hands. If you created a new
jar, you can put a Class-Path entry in it that includes whatever jars
you want and hides the rest.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top