title: Why does my Mineraft plugin give me the error "cannot find main class"?
body: <p>I have just started to learn how to develop Minecraft server plugins but whenever I try to load my plugin onto a server for testing it throws me the error: Cannot find main class 'me.light.bukkit.Main'</p>
  
  <p>My code for main class:</p>
  
  <pre><code>package me.light.bukkit;
  
  import org.bukkit.plugin.java.JavaPlugin;
  
  public class Main extends JavaPlugin {
  
      @Override
      //when plugin is enabled
      public void onEnable() {
          new PlayerListener(this);
      }
  
      @Override
      //when plugin is disabled (ie saving stuff)
      public void onDisable() {
  
      }
  }
  </code></pre>
  
  <p>My code for PlayerListener Class :</p>
  
  <pre><code>package me.light.bukkit;
  
  import org.bukkit.ChatColor;
  import org.bukkit.entity.Player;
  import org.bukkit.event.EventHandler;
  import org.bukkit.event.Listener;
  import org.bukkit.event.player.PlayerEggThrowEvent;
  import org.bukkit.plugin.Plugin;
  
  public class PlayerListener implements Listener{
  
      public PlayerListener(Main plugin) {
          plugin.getServer().getPluginManager().registerEvents(this, (Plugin) plugin);
      }
  
      @EventHandler
      public void blank(PlayerEggThrowEvent event) {
  
          Player player = event.getPlayer();
  
          player.sendMessage(ChatColor.RED + "DO NOT THROW EGGS");
  
          player.kickPlayer("You were throwing eggs!");
  
      }
  }
  </code></pre>
  
  <p>And finally my plugin.yml</p>
  
  <pre><code>name: Illumination
  main: me.light.bukkit.Main
  version: 1.0
  author: kb
  description: First Plugin
  commands:
  </code></pre>
  
  <p>Also here is the error that the server gave me</p>
  
  <pre><code>Java HotSpot(TM) 64-Bit Server VM warning: ignoring option     MaxPermSize=128M; sup
  port was removed in 8.0
  Loading libraries, please wait...
  [19:41:24 INFO]: Starting minecraft server version 1.8
  [19:41:24 INFO]: Loading properties
  [19:41:25 INFO]: Default game type: SURVIVAL
  [19:41:25 INFO]: Generating keypair
  [19:41:25 INFO]: Starting Minecraft server on *:25565
  [19:41:25 INFO]: This server is running CraftBukkit version git-Bukkit-    ee6d0fa (
  MC: 1.8) (Implementing API version 1.8-R0.1-SNAPSHOT)
  [19:41:25 ERROR]: Could not load 'plugins\illumination.jar' in folder     'plugins'
  org.bukkit.plugin.InvalidPluginException: Cannot find main class     `me.light.bukki
  t.Main'
          at org.bukkit.plugin.java.PluginClassLoader.&lt;init&gt;    (PluginClassLoader.jav
  a:42) ~[craftbukkit.jar:git-Bukkit-ee6d0fa]
          at     org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
  ava:129) ~[craftbukkit.jar:git-Bukkit-ee6d0fa]
          at     org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
  java:328) ~[craftbukkit.jar:git-Bukkit-ee6d0fa]
          at     org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
  .java:251) [craftbukkit.jar:git-Bukkit-ee6d0fa]
          at     org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugins(CraftServer.ja
  va:288) [craftbukkit.jar:git-Bukkit-ee6d0fa]
          at org.bukkit.craftbukkit.v1_8_R1.CraftServer.&lt;init&gt;    (CraftServer.java:25
  0) [craftbukkit.jar:git-Bukkit-ee6d0fa]
          at net.minecraft.server.v1_8_R1.PlayerList.&lt;init&gt;    (PlayerList.java:69) [c
  raftbukkit.jar:git-Bukkit-ee6d0fa]
          at net.minecraft.server.v1_8_R1.DedicatedPlayerList.&lt;init&gt;    (SourceFile:14
  ) [craftbukkit.jar:git-Bukkit-ee6d0fa]
          at     net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.jav
  a:133) [craftbukkit.jar:git-Bukkit-ee6d0fa]
          at     net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java
  :484) [craftbukkit.jar:git-Bukkit-ee6d0fa]
          at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]
  Caused by: java.lang.ClassNotFoundException: me.light.bukkit.Main
          at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_25]
          at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_25]
          at java.security.AccessController.doPrivileged(Native Method)     ~[?:1.8.0_
  25]
          at java.net.URLClassLoader.findClass(Unknown Source)     ~[?:1.8.0_25]
          at     org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
  java:77) ~[craftbukkit.jar:git-Bukkit-ee6d0fa]
          at     org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
  java:62) ~[craftbukkit.jar:git-Bukkit-ee6d0fa]
          at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
          at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
          at java.lang.Class.forName0(Native Method) ~[?:1.8.0_25]
          at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_25]
          at org.bukkit.plugin.java.PluginClassLoader.&lt;init&gt;    (PluginClassLoader.jav
  a:40) ~[craftbukkit.jar:git-Bukkit-ee6d0fa]
          ... 10 more
  [19:41:25 INFO]: Preparing level "world"
  [19:41:25 INFO]: Preparing start region for level 0 (Seed:     -6785130429683314732)
  
  [19:41:26 INFO]: Preparing start region for level 1 (Seed:     -6785130429683314732)
  
  [19:41:26 INFO]: Preparing start region for level 2 (Seed:     -6785130429683314732)
  
  [19:41:26 INFO]: Server permissions file permissions.yml is empty,     ignoring it
  [19:41:26 INFO]: Done (1.351s)! For help, type "help" or "?"
  </code></pre>
  
  <p>I have tried to fix this numerous times but to no avail. I have tried renaming things in my plugin.yml, moving my plugin.yml around in my plugin, and changing the names of my classes but nothing has worked. Any help will be appreciated.</p>