Forums Register Login

Implementing class not recognized as implementer ("class identity crisis"?)

+Pie Number of slices to send: Send
Hey there,

I'm currently working on a small program which loads additional modules dynamically on startup from a specific "module folder".
To handle jar-loading I'm using "JCL" (Jar Class Loader), a framework which seems to use the system class loader. Every "module"-jar must contain a class which implements a "Starter" interface.

So, what's my problem?
The Windows XP-JVM does'nt recognize the "Starter" classes as implementers of the "Starter" interface (the instanceof-test returns false). The odd thing is, that the same program with exactly the same jars works fine when running on Windows Vista or ubuntu Linux (I haven't tried on other platforms yet).

Does anyone know why the JVM is behaving like this and how to solve this problem?

I'm asking here because to me this seems to be a Java problem, not a problem with the framework...
+Pie Number of slices to send: Send
Saying "Windows XP JVM" and Vista or Ubuntu JVM is not sufficient -- what specific version of the JVM (JRE) do you have installed in the various environments? If the versions are different, there may be very good reasons why this works in one place and not another.

You can get this by typing "java -version" at the command prompt.

+Pie Number of slices to send: Send
Hi again,

all tested environments are using Sun Java 6.

ubuntu: 1.6.0_15
Can't tell the Vista version, because I recently installed Windows 7 instead, but I think it was 1.6 Update 14 or above

Windows XP (tested on several different machines):
1.6.0_14
1.6.0_15
and another 1.6-Version, which I can't tell because I ran it on a colleague's machine. I'll be able to post his Java-Version tomorrow. ;)

EDIT:
Just tested it with Windows 7 (64bit), which also doesn't work.
Version: 1.6.0_18
+Pie Number of slices to send: Send
Without any real details it's going to be impossible to help. Right now it seems like there might be an issue with the loader you're using, but it's hard to say.
+Pie Number of slices to send: Send
When I'm back home I can post the method I'm using if this would be helpful.

Anyway, maybe I'm just thinking in the wrong direction.
Is there a way someone of you would recommend to dynamically load modules in a plugin-like way? If there is an easy-to-implement way using JavaSE classes I of course would prefer that rather than using a third party framework like the Jar Class Loader.
+Pie Number of slices to send: Send
Just put them on the class path and instantiate--I'm not sure what that doesn't do that you're trying to.
+Pie Number of slices to send: Send
 

David Newton wrote:Just put them on the class path and instantiate--I'm not sure what that doesn't do that you're trying to.



The main problem is, that I don't really now the module folder's path before starting the program. Is there a way to "extend" the classpath AFTER starting the JVM? That might be really helpful. ;)
Trust God, but always tether your camel... to this tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1060 times.
Similar Threads
share an instance but create new one for every new process
EARs, WARs, classpaths, and manifests
Problem using ClassLoader
Order in which class is searched
Using log4j in EAR module
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:27:14.