I got this error and I don't know why... (Waiting for answer)

Discussion in 'Plugin Development' started by frozenpoptartmc, Aug 15, 2012.

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

    frozenpoptartmc

    ...I just created my first "plugin".
    I watched a basic YouTube tutorial on what I'm supposed to do.
    I copied the code exactly and did what he did, but got this error.

    [SEVERE] Could not load 'plugins\firstplugin.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/frozenpoptart/WarpAll/WarpAll : Unsupported major.minor version 51.0
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:155)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:222)
    at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:198)
    at net.minecraft.server.ServerConfigurationManagerAbstract.<init>(ServerConfigurationManagerAbstract.java:50)
    at net.minecraft.server.ServerConfigurationManager.<init>(SourceFile:11)
    at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:105)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:380)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: java.lang.UnsupportedClassVersionError: me/frozenpoptart/WarpAll/WarpAll : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:41)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:144)
    ... 9 more
     
  2. Offline

    TheSmallBones

    Change your java version in the plugin to java 1.6?
     
  3. Offline

    frozenpoptartmc

    How would I do that?

    I'm clueless. xD

    Help?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  4. Offline

    Timr

    The version of Java the server is running should always match that of what the plugin is compiled against. If you're running jre6 on your server, compile against jre6. jre7 on the server, compile against jre7, etc..
     
  5. Offline

    icode

    Did you refresh the project before exporting?
     
  6. Offline

    dchaosknight

    Go to http://www.java.com/ and download the latest java version.
     
  7. Offline

    Sagacious_Zed Bukkit Docs

    No. the latest java version is 7u6 which is not what the OP wants to compile against if the server is running 6. Also even with a 7JDK you can compile for 6.
     
  8. Offline

    Courier

    Or (if you have any sort of control on your server) you could use JRE7. If you are using OpenJDK7, you might have to set the environment variable $JAVA_VERSION to 1.7
    Code:text
    1. //bash
    2. export JAVA_VERSION=1.7
    3. //tcsh
    4. setenv JAVA_VERSION 1.7
    Don't quote me on the syntax... I only use tcsh. If you plan on distributing the plugin, it is best to compile for Java 6, since many servers are locked in to Java 6.
    That is true, but I've heard that you can run into problems with that, it is best to compile against JRE6. If I remember correctly, javac warns you if you compile for a different version than the one in your boothclasspath. If you use Eclipse it is easy because Eclipse handles everything.
     
Thread Status:
Not open for further replies.

Share This Page