My plugin will not load when I put it in a server.

Discussion in 'Plugin Development' started by NightTerror, May 24, 2021.

  1. Offline

    NightTerror

    So I'm new to plugin dev, and I'm creating a survival games plugin, but every time I put the plugin into my plugins folder and start the server I get this error:

    [14:18:35] [Server thread/WARN]: Legacy plugin TerrorGames v1.0 does not specify an api-version.
    [14:18:35] [Server thread/ERROR]: Could not load 'plugins\TerrorGamesTest1.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `io.github.nightterror04'
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:393) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:179) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:787) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:155) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at java.lang.Thread.run(Thread.java:832) [?:?]
    Caused by: java.lang.ClassNotFoundException: io.github.nightterror04
    at java.net.URLClassLoader.findClass(URLClassLoader.java:435) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:468) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit.jar:2991-Bukkit-f3f3094]


    I really don't know what I'm doing wrong so any help is greatly appreciated!
    I attached the lastest.log for anyone who wants to look at it.
     

    Attached Files:

  2. Offline

    davidclue

    In your plugin.yml you did not state the proper path to the main class
     
  3. Offline

    TheDepressedOne

    Could ya send your plugin.yml? Along with your plugins class structure, your path to your main class is incorrect :).
     
  4. Offline

    KarimAKL

    @NightTerror You should set 'main' in the plugin.yml file to the full path of your main class, not just the package it is in. e.g. "io.github.nighterror04.Main" instead of "io.github.nighterror04"
     
  5. Offline

    NightTerror

    okay thanks! I'll try this!

    Yeah sure! I don't know how to attach the plugin.yml but this is what it has in it
    Code:
    name: TerrorGames
    main: io.github.nightterror04
    version: 1.0
    load: POSTWORLD
    description: >
                 A Plugin By NightTerror
    commands:
      tg:
        description: Main command.
      vote:
        description: Vote command.
      votestart:
        description: Vote command.
    edit: I changed the main to io.github.nightterror04.main and added the api-version but it still doesn't work

    ]Okay I figured out what was happening but now I'm getting this log any help?
    Code:
    [21:11:50] [Server thread/ERROR]: Fatal error trying to convert TerrorGames v1.0:me/TerrorGames/SurvivalGames/Main.class java.lang.IllegalArgumentException: Unsupported class file major version 8243     at org.bukkit.craftbukkit.libs.org.objectweb.asm.ClassReader.<init>(ClassReader.java:189) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.craftbukkit.libs.org.objectweb.asm.ClassReader.<init>(ClassReader.java:170) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.craftbukkit.libs.org.objectweb.asm.ClassReader.<init>(ClassReader.java:156) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.craftbukkit.v1_16_R3.util.Commodore.convert(Commodore.java:128) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.craftbukkit.v1_16_R3.util.CraftMagicNumbers.processClass(CraftMagicNumbers.java:327) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:140) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]     at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]     at java.lang.Class.forName0(Native Method) ~[?:?]     at java.lang.Class.forName(Class.java:468) ~[?:?]     at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:393) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:179) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:787) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:155) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at java.lang.Thread.run(Thread.java:832) [?:?] [21:11:50] [Server thread/ERROR]: Could not load 'plugins\TerrorGamesTest6.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/TerrorGames/SurvivalGames/Main has been compiled by a more recent version of the Java Runtime (class file version 8243.8224), this version of the Java Runtime only recognizes class file versions up to 59.0     at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:393) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:179) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:787) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:155) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at java.lang.Thread.run(Thread.java:832) [?:?] Caused by: java.lang.UnsupportedClassVersionError: me/TerrorGames/SurvivalGames/Main has been compiled by a more recent version of the Java Runtime (class file version 8243.8224), this version of the Java Runtime only recognizes class file versions up to 59.0     at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]     at java.lang.ClassLoader.defineClass(ClassLoader.java:1016) ~[?:?]     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151) ~[?:?]     at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:163) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]     at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]     at java.lang.Class.forName0(Native Method) ~[?:?]     at java.lang.Class.forName(Class.java:468) ~[?:?]     at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:2991-Bukkit-f3f3094]     ... 7 more
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2021
  6. Offline

    davidclue

    @NightTerror You're getting an error because you compiled the plugin in a newer version of java, just compile it in java 8 and you won't have any issues.
     
  7. Offline

    NightTerror

    I switched the plugin to java 8 but now I'm getting the log shown here
     
  8. Offline

    davidclue

    @NightTerror Weird, switch it up to java 15 since the error says it only recognizes class files up to 59.0 also you can use this for future reference.
     

Share This Page