bukkit插件未加载classnotfoundexception

monwx1rj  于 2021-07-08  发布在  Java
关注(0)|答案(1)|浏览(447)

我在加载插件时遇到了一些问题。我已经修复了一些小问题,但找不到下一条错误消息的解决方案:

[08:59:47] [Server thread/ERROR]: Could not load 'plugins\HelloWorld.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.CocoArana.005.HelloWorld.Main'
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:393) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:179) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:786) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:155) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]
Caused by: java.lang.ClassNotFoundException: me.CocoArana.005.HelloWorld.Main
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_221]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_221]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_221]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_221]
        at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_221]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        ... 8 more

如您所见,错误并不指向我的代码,而是指向导入的库。已更换,但仍不起作用。
你能帮帮我吗?

z2acfund

z2acfund1#

看来你的 plugin.yml 坏了,我建议把线里的东西换成 main: 通过正确的路径进入插件的主类。
这个类还必须从 JavaPlugin 所以这也可能是这个错误出现的原因。

相关问题