Note that there are some explanatory texts on larger screens.

plurals
  1. POURLClassLoader does not read external JAR library of a plugin
    text
    copied!<p>I have implemented a simple plugin based application with Java. Main plugin class is derived from and abstract class called "Plugin". The application reads that class from JAR file and runs the plugin by creating an instance of the class. Standard procedure I guess :)</p> <p>Everything forks fine until now. But the problem occurs when I include a library to my plugin, like MySQL Connector. The exception NoClassDefFoundError and ClassNotFoundException are thrown after execution. I am overcoming the problem by adding MySQL connector library to the main application but what is the point then? :)</p> <p>I am not a Java expert so I am not sure of any alternative solutions like defining a classpath for libraries etc.</p> <p>Here is my plugin loader: <a href="http://pastebin.com/90rQ9NfJ" rel="nofollow">http://pastebin.com/90rQ9NfJ</a></p> <p>And here is my plugin base class: <a href="http://pastebin.com/Juuicwkm" rel="nofollow">http://pastebin.com/Juuicwkm</a></p> <p>I am executing from a GUI:</p> <pre><code> private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileFilter(new FileNameExtensionFilter("JTask Plugin (*.JAR)", "JAR")); if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File pluginFile = fileChooser.getSelectedFile(); PluginLoader pluginLoader = new PluginLoader(); Plugin plugin = pluginLoader.loadPlugin(pluginFile); if (plugin != null) jPanelPlugins.add(new PluginControl(jPanelPlugins, plugin)); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload