Could not find 'main' Class

Discussion in 'Plugin Development' started by Arashna, Aug 2, 2019.

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

    Arashna

    [13:11:09] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-06efc9e (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
    [13:11:16] [Server thread/ERROR]: Could not load 'plugins\WatermanHouse.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `Plugin.WatermanHouse'
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:61) ~[craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:333) ~[craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:253) [craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at org.bukkit.craftbukkit.v1_14_R1.CraftServer.loadPlugins(CraftServer.java:348) [craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at net.minecraft.server.v1_14_R1.DedicatedServer.init(DedicatedServer.java:196) [craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:753) [craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at java.lang.Thread.run(Unknown Source) [?:?]
    Caused by: java.lang.ClassNotFoundException: Plugin.WatermanHouse
    at java.net.URLClassLoader.findClass(Unknown Source) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:135) ~[craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:81) ~[craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Unknown Source) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:59) ~[craftbukkit-1.14.4-R0.1-SNAPSHOT.jar:git-Bukkit-06efc9e]
    ... 7 more

    The Plugin and Export from eclipse worked just fine until I've added a new class (which isn't the main class!!).
    I've seen through a lot of different Bukkit Forums where people had similar problems but couldn't find a solution. It must be either a problem with the creation of the Jar-file or sth. has to be wrong in the Info-file but I can't figure what the problem is... plz give me a hint in the right direction.

    I've looked in the zip-file after I exported it from eclipse. WatermanHouse.java , AdvancedMaterial.java und die plugin Datei sind enthalten. vergesse ich etwas?

    this is the plugin.yml-file:
    Code:
    name: Waterman_House-Plugin
    main: Plugin.WatermanHouse
    author: Robin von Allmen
    version: 1.3
    api-version: 1.14
    commands:
        watermanhouse:
            description: Erstellt die Huette des Faehrmannes
            usage: /watermanhouse
    and this is how my java files are named
     

    Attached Files:

    Last edited by a moderator: Aug 2, 2019
  2. Online

    timtower Administrator Administrator Moderator

    @Arashna After exporting you need .class files, not .java
     
  3. Offline

    Arashna

    @timtower but I've got other Plugins which do work n they are *.java too
    anyway do u know how I could do that with Eclipse? It's worth a try

    I forgot to click on a cofiguration during exporting the file... it works now but when I use the command Ingame it throws a nullPointerException

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 2, 2019
  4. Offline

    Kars

    You are forgetting to speak english, first of all.

    If it worked before you changed something other than just adding a class. There is no other way. To be sure, check that your main class extends JavaPlugin.
     
  5. 1) Make sure your main link is correct in your plugin.yml
    2) Make sure your main class extends to JavaPlugin so for example:
    public class Main extends JavaPlugin {}

    PS: ignore the trippy weird symbols i don't even know why they are there

    Please provide your command's code and the error that is displayed in console and we can help you with your nullpointer exception

    EDIT: why did you say that you exported it as a .zip file? you're meant to export it as a .jar file then put it in the plugins folder of your server
     
    Last edited by a moderator: Aug 3, 2019
Thread Status:
Not open for further replies.

Share This Page