Accessing non-Plugin classes in external plugins

Discussion in 'Plugin Development' started by Shados, Jan 17, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Shados

    If I have two plugins, A.jar and B.jar, and in A I have my Plugin class (let's call it APlugin?) and another class, used by it, which we'll call AnotherClass. I can access, instantiate and just generally use AnotherClass just fine from APlugin, however, if I attempt to use it from BPlugin I get a NoClassDefFoundError on AnotherClass at runtime.

    Am I missing something here, is this intentional, or just an error/oversight?
     
  2. Offline

    Raphfrk

    You might want to post the question in the inter-plugin discussion thread.

    It might be an oversight.
     
  3. Offline

    Earth-Fury

    The plugin loader creates a new URLClassLoader for each plugin, utilizing the plugin loader's class loader as the parent.

    This prevents one plugin's classes from seeing the classes loaded by another plugin's class loader.

    The solution is for the plugin loader in Bukkit to construct a new, custom class loader that can be used for all the plugins at once.
     
  4. Offline

    Raphfrk

    Also, many plugins would have to be moved so that they aren't in the default package :).
     
  5. Offline

    Shados

    I can live with that. People really shouldn't be using the default package for anything other than teaching really basic Java stuff without the extra hassle/lines of dealing with packages.
     
Thread Status:
Not open for further replies.

Share This Page