Jump to content
  • Advertisement
Sign in to follow this  
Cipher3D

[java] Java's equivalent of DLLs?

This topic is 4723 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Self explanatory. Is it possible to write a plugin architecture with Java? I know Eclipse did it; hopefully it's not too complicated to do. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Class files. Class loader, reflection, interfaces, abstract classes [google]

Share this post


Link to post
Share on other sites
You can work with DLLs in java - use the System class or the Runtime class to load them. Take a look at the documentation for more details.

As far as plugins are concerned, you can build entire frameworks and package them in a single .jar file, to be used as a library or as an extension for your applications. This approach is often used to provide a certain level of interaction between two or more application with different taks.

No need to mention that you will have to prepare the targetting application's architecture to be able to use such extension - and that's where you get a hold on Washu's suggestion and google for standard implementation.

Share this post


Link to post
Share on other sites
Although often a full classloader isn't needed. I've often done a really simple version simply by defining a base class and/or interface, then listing the plug-in's class name in an external data file. Chuck in a bit of Class.forName(String) and Class.newInstance() and you're done. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Rickmeister
The pdf document is a complete guide on how to write your own classloader, with the option to be able to load uncompiled .java files. Can be useful for scripting and runtime editing.

Or you could use Beanshell, which does exactly that (and more) and is already written and debugged. [razz]

Share this post


Link to post
Share on other sites
It's offline right now >:( (whilst mangling the HTTP parser to try and help Sun fix what *appears to be* an ultra-serious bug in NIO) but http://javagamesfactory.org has free source code for a rather excellent automatic class locater and loader, which you may well find rather helpful.

Can't copy/paste the URL cos the server's offline :(.

It doesn't have a dynamic classloader built-in, IIRC, but the source is there, with syntax highlighting, so you're free to alter it yourself.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!