Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Drews Clausen
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
W Fay
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Drews Clausen
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Drews Clausen
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just put them on the class path and instantiate--I'm not sure what that doesn't do that you're trying to.
 
Drews Clausen
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. ;)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic