Unsupported major.minor version 51.0?

Discussion in 'Plugin Development' started by STiChad, Dec 5, 2011.

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

    STiChad

    I'm getting that error on all the plugins I make, but the error only happens on my hosted sever.
    They run just fine on my computer but fail everytime on the hosted one.
    I re-installed the 1.7 JDK and everything worked fine, I checked the compiler version and then my java version and they all said 1.7.0_0.1.
    And I asked my host what version of Java they are running and they promptly replied with 1.7.
    Which makes sense as they are:
    1. A minecraft server host
    2. All the other plugins I use work fine.
    I'm using Eclipse and it has the 1.7 library loaded.
    So I honestly don't understand what the problem is.
    Thanks for any help.

    Here is the complete error:
    Show Spoiler

    2011-12-05 02:13:51 [SEVERE] Could not load 'plugins\SacredBlock.jar' in folder 'plugins':
    java.lang.UnsupportedClassVersionError: me/stichad/sacredblock/SacredBlock : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    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:36)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
    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.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:170)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:215)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:147)
    at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:123)
    at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:52)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:141)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:388)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
     
    phaed likes this.
  2. Offline

    se1by

    Well, at least this is a version error.
    Just try to recompile it with java 1.6 and it should work.
     
  3. Offline

    thehutch

    Try setting up a local server so you can rule out the host server it might be them for all we know :D
     
  4. Offline

    STiChad

    I did and I had no errors on my personal server.
    But it has to be something I'm doing because all the other plugins I use on the hosted server work perfectly fine.

    That would require me to download the 1.6 JDK, correct?(Cause thats what I'm doing)
     
  5. Offline

    halley

    If you have the 1.7 version, you can configure compiles to support ONLY 1.6 features.

    That's the preferred state of affairs unless you're rebuilding everything from scratch on a whole server.
     
  6. Offline

    garbagemule

    This is indeed a JDK/JRE version issue. You have compiled with JDK7 and are trying to run the jar with JRE6 or below. If you don't want to mess around with going back to JRE6 for everything, you need to tinker with your settings. In your IDE of choice, there will be a setting to compile with certain JDK's, so choose 1.5 (Bukkit and Minecraft are both Java 1.5, but 1.6 should do in most cases).

    If you use an ant build file, put source="1.6" target="1.6" in the javac task's attributes.
     
  7. Offline

    STiChad

    Alright, I recompiled it in 1.6 and I'll test it in the morning.(Crossing my fingers)
    But I don't understand why 1.7 wouldn't work.
    I asked the host and they said the server runs 1.7.
    Just an odd thing to lie about, if thats the case.

    It worked just fine after recompiling it in 1.6.
    Thanks @garbagemule , @halley , @se1by
    Still don't understand why the host would tell me they are running 1.7 when they aren't but no big deal.

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

    garbagemule

    Chances are the host thinks he's running 1.7. More than likely, he hasn't verified it with a simple "java -version" in the terminal :)
     
  9. Offline

    STiChad

    Is there a way I can have a plugin check the Java version that the server is running?
    It would be kinda funny to say "Ha! You're wrong!" and have proof.
     
  10. Offline

    Acrobot

  11. Offline

    STiChad

    Did that and they have 1.7.0, I guess the difference is I have 1.7.0_0.1?
    Technically the person was right, just wasn't the latest version of 1.7.
    No matter, just going to use 1.6 to avoid any further problems. Thanks again.
     
Thread Status:
Not open for further replies.

Share This Page