Plugin not exporting

Discussion in 'Plugin Development' started by Anrza, May 8, 2014.

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

    Anrza

    I'm very new to plugin development, and every time I try to export my plugin, I get this message:
    Class files on classpath not found or not accessible for [plugin .java file].

    Please help, I'm not sure what to include here, so please ask me if you need to know anything to solve this.
     
  2. Offline

    Anrza

    Bump, still not solved;
    Could not load 'plugins/Another.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: me.Anrza.Another.Main
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.java:241)
    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.reload(CraftServer.java:613)
    at org.bukkit.Bukkit.reload(Bukkit.java:277)
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:192)
    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.dispatchCommand(CraftServer.java:528)
    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.dispatchServerCommand(CraftServer.java:515)
    at net.minecraft.server.v1_6_R3.DedicatedServer.as(DedicatedServer.java:263)
    at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:228)
    at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:488)
    at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:421)
    at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    Caused by: java.lang.ClassNotFoundException: me.Anrza.Another.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
    ... 14 more
     
  3. Offline

    cdriza

    Hmmm.... It seems me.Anrza.Another.Main is not found, you specified that in the plugin.yml to find what it actually is...
    Step 1. Open another.jar (DON'T RUN IT) in a program like WinRar
    Step 2. Click me, Anrza, and Another, then see if Main.class is a class,
    Step 3. If it is, go back one check if Another is spelled correctly
    Step 4. Go back again check if Anrza is spelled correctly
    Step 5. Then check if me is spelled correctly.
    Step 6. Check if Main extends JavaPlugin in the very beggining

    Note: Even if it is spelled correctly, check if the caps match me.Anrza.Another.Main (those are folders and main is main.class)

    Hope this helped you! :D
     
  4. Offline

    toCoda

    So it's unable to find your Main class. Check that the main field in plugin.yml matches the package in your class (could well be an issue of case-sensitivity) and check that your main extends JavaPlugin
     
  5. Offline

    Anrza

    This is my plugin.yml:
    name: Another
    main: me.Anrza.Another.Main
    version: 1.0
    description: >
    Another test
    commands:
    Another:
    description: Sends you a message

    And this is my plugin, as it appears in eclipse:
    Another
    src
    me.Anrza.Another
    Main.java
    plugin.yml


    Failed on step 2, because there is no "me" folder in it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  6. Offline

    cdriza

    Upload your plugin, then there is definetely an error...

    It should look like this in your plugin.jar:
    [​IMG]

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  7. Offline

    Anrza


    That exactly what it looks like, except I don't have the "me" folder.
     
  8. Offline

    cdriza

    Anrza
    errr yeah... then something went wrong. Upload Another.jar to
    mediafire.com
    or
    dropbox.com

    Does it look like this?:
    [​IMG]
     
  9. Offline

    Anrza

  10. Offline

    cdriza

    Anrza
    erm... There is absalutely no code in their whatsoever, just the manifest file and the classpath project and plugin.yml... Try exporting again, right click on the project, click java, jar file, name it Another.jar in wherever, then try again.
     
  11. Offline

    Anrza


    I fail on "right click on the project". Where am I suppose to click this? In the project explorer on the left? Gives me the "you're clicking outside the box"-error sound.
     
  12. Offline

    cdriza

    Anrza Errr, i don't know then i'll just do it for you if its this much trouble, just paste the main.class/main.java code in the code box aka [ CODE ] without the spaces, or click the "code" button and copy and paste everything into it.
     
  13. Offline

    Anrza


    Oh, great! I needed someone to code the exact plugins I wanted for my server, which I have five pages of mechanics on (sarcasm).

    Yea, thing is, I wanna learn to code myself. Thanks for offering, and thanks for trying to help me! :)

    So, anyone else got any idea why I'm failing?
     
  14. Offline

    cdriza

    errr... I was just asking that as that seems like a project error, not you failing to right click on the project and press "Export" lol, whatever though try it again

    RIGHT CLICK ON THE MAIN JAVA PROJECT, CLICK EXPORT, AND THEN CLICK JAR FILE, THEN NAME IT ANOTHER.JAR

    IF YOU FAIL TO DO THAT
    YOU WILL NEVER BE A CODER. lol

    Anyway, the reason your failing is because there is no code, just the plugin.yml and metadeta.

    I'm starting to assume this is a troll post, you can't somehow get everything but the code unless you have no code.
     
  15. Offline

    Anrza


    Oh, I guess I misunderstood you. Sorry. Laughed at "if you fail to do that...", yea, I misunderstood you pretty badly.

    Code:
    package me.Anrza.Another;
     
    import java.util.logging.Logger;
     
    import net.minecraft.server.v1_5_R3.PlayerInventory;
     
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Another extends JavaPlugin{
            public final Logger logger = Logger.getLogger("Minecraft");
            public static Another plugin;
         
            @Override
            public void onDisable() {
                    PluginDescriptionFile pdfFile = this.getDescription();
                    this.logger.info(pdfFile.getName() +  "Has been Disabled!");
                 
            }
         
            @Override
            public void onEnable() {
                    PluginDescriptionFile pdfFile = this.getDescription();
                    this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() +  "Has been Enabled!");
                 
            }
         
            public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
                    Player player = (Player) sender;
                    if(commandLabel.equalsIgnoreCase("Another"));
                    player.sendMessage("Another was sent ");//Your message
                    return false;
            }
    }
    I followed this tutorial for the code.
     
  16. Offline

    cdriza

    @Anzra That tutorial is way outdated, 1.5 but the code should still work as I followed a tut made a year ago and the code still worked xD

    The code is fine, its just the damned eclipse export system...

    Speaking of damned eclipse, it won't open...
     
  17. Offline

    rsod

    You shouldn't use
    Logger.getLogger("Minecraft");
    instead use this.getLogger();
     
  18. Offline

    cdriza

    Well, actually eclipse did open... just a long delay because of a coin-miner macromedia PUP lol...

    Now I have 43 eclipse windows...
    Wow.
    and rsod you sir are correct, didn't notice that!
     
  19. Offline

    Anrza


    I've failed with a couple of other tutorials too. I'm getting the same error almost every time, and I guess it's some setting of mine that makes it pretend like the class isn't there.
     
  20. Offline

    Jaaakee224

    Another big problem: You're watching the TheBCBroz.
     
  21. Offline

    cdriza

    Anrza
    Also I can tell even without the code, i looked at the .classpath and .project, your using CB 1.6.4 for MC 1.6.4 you know?

    oh and your trying to use craftbukkit 1.6.4, not bukkit 1.6.4

    #BIGMISTAKEMISTER

    Jaaakee224
    I thought TheBCBroz was a good channel... :'(


    JK

    anyway, thats not TheBCBroz

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  22. Offline

    Anrza


    Huh? So if I fix this, will my problems be solved? And if so, how do I fix them?


    I have one class. Very sure it's called Main, Main.java.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  23. Offline

    cdriza

    Anrza[quote uid=90916372 name="Anrza" post=2485580]Huh? So if I fix this, will my problems be solved? And if so, how do I fix them?[/quote]
    Fixed the plugin: <Edit by Moderator: Redacted mediafire url>

    Enables: [​IMG]

    And it works even on 1.7.2 builds!: [​IMG]


    Fixed code:
    Code:java
    1. package me.Anrza.Another;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import org.bukkit.*;
    6. import org.bukkit.entity.*;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.inventory.ItemStack;
    13. import org.bukkit.plugin.PluginDescriptionFile;
    14. import org.bukkit.plugin.java.JavaPlugin;
    15.  
    16. @SuppressWarnings("unused")
    17. public class Main extends JavaPlugin{
    18. public final Logger logger = Logger.getLogger("Minecraft");
    19. public static Main plugin;
    20.  
    21. @Override
    22. public void onDisable() {
    23. PluginDescriptionFile pdfFile = this.getDescription();
    24. this.logger.info(pdfFile.getName() + "Has been Disabled!");
    25.  
    26. }
    27.  
    28. @Override
    29. public void onEnable() {
    30. PluginDescriptionFile pdfFile = this.getDescription();
    31. this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + "Has been Enabled!");
    32.  
    33. }
    34.  
    35. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
    36. Player player = (Player) sender;
    37. if(commandLabel.equalsIgnoreCase("Another"));
    38. player.sendMessage("Another was sent ");//Your message
    39. return false;
    40. }
    41. }


    SkillSam[quote uid=90817361 name="SkillSam" post=2485599]Anrza I'm not very sure anymore, the code you posted before had the class name of Another.java, not Main.java...[/quote]
    Thats true, I had to fix that it is sussposed to be Main extends JavaPlugin not Another extends JavaPlugin and not Public Static Another Plugin, you use Public Static Main Plugin

    ITS THE NAME OF THE CLASS FILE

    NOT THE PLUGIN

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 2, 2016
  24. Offline

    Anrza

    [quote uid=90952759 name="cdriza" post=2485596]Anrza
    Fixed the plugin: <Edit by Moderator: Redacted mediafire url>
    [/quote]

    Thank you! I will look in the .jar and see what I can learn from it!

    [quote uid=90817361 name="SkillSam" post=2485599]Anrza I'm not very sure anymore, the code you posted before had the class name of Another.java, not Main.java...[/quote]


    Hmm, dunno, maybe it's solved now. Thanks for bothering.
     
    Last edited by a moderator: Nov 2, 2016
  25. Offline

    cdriza

    Anrza
    You can't learn anything from the .jar file, lel

    Use the code that I posted to learn my friend :3

    Anrza
    USE THE CODE!!!!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
Thread Status:
Not open for further replies.

Share This Page