0

I've asked around and looked around for the better part of a month and I just can't find a solution.

Okay so I need help from someone who's used Java Class loaders before. Specifically, someone who's dealt with the issue of a class being in a jar file but it throws a ClassDefNotFound Exception.

Essentially, I'm trying to create a plugin loader for a project of mine (https://github.com/CloudGamer360/Project-ArchT5 - See "development" branch for latest code) so the net.cloudsbots.archseriest.archt5.plugin.PluginManager class should be the only important thing there. I've made a plugin which loads fine with it in the past with no errors so I feel like my plugin loader is fine but I don't know, could be a thing where I've missed something as the plugin which worked was much smaller and less complex.

Anyway, what I think the problem is but I dunno quite yet after tons of failed fixes is the plugin itself. Called ArcadeT5, it's a game "engine" plugin for my ArchT5 project, meant to make game development for the bot easier. (Found here https://github.com/CloudGamer360/ArcadeT5) I get a few of it's classes to load, iterating through the jar file, until it gets to loading the net.cloudsbots.arcadet5.games.Game class, in which it throws a ClassDefNotFound Exception in the PluginManager at the call of defineclass() (line 177 on development)

Screenshots of log:

Evan M
  • 2,573
  • 1
  • 31
  • 36
Will
  • 1
  • 3
  • The problem might be that the calls might be in internal package or the class package is in not imported. Please check your manifest file for the imports. – StackFlowed Apr 26 '19 at 14:31
  • I'm pretty sure that's not the issue as classes which are loaded prior to it would have the same issues otherwise. – Will Apr 26 '19 at 15:10

1 Answers1

0

Figured it out myself after noticing something with the loader. It appears that if a class inherits another class which hasn't been loaded, it'll throw a NoClassDefFoundError.

If you're making a custom classloader which calls methods like 'defineClass', make sure to catch any NoClassDefFoundError Exceptions and load the classes required as that will save you a few headaches.

Will
  • 1
  • 3