Minecraft 1.17 is actually compiled with JDK 16?

Discussion in 'Programming' started by AppledMC, Jul 16, 2021.

  1. In the recent update (1.17) we all know that jdk 16 is required for running minecraft 1.17 both client and server.
    I confirmed that Minecraft 1.17 (Client) is actually compiled with JDK 16. I dont know about the official server (i didnt check!) but when i decomplied the spigot 1.17 jar and noticed that the Main class (org.bukkit.craftbukkit.Main) is coded like:

    float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
    if(javaVersion < 60.0){
    System.out.println("JDK 16 required error string...");
    return;
    }
    if(javaVersion > 60.0){
    System.out.println("Only JDK 16 required error string...");
    return;
    }
    And i found that complied jar version is 52.0 what if we actually get rid of that code
     
  2. Because you compiled it with Java 8.
     
  3. No, the original jar is compiled with java 8 and is coded to check if class version is 60 or not else it prints the error that JDK 16 is required | Only JDK 16 required. I am asking if we got rid of that code :)
     
    • Like Like x 1
  4. Also I didn't compile it because I don't have the source.
     
  5. The bytecode level may be the same as that of java 8 (-target 1.8), but the code could still use apis from the standard library that were introduced in later java versions.
     
    • Useful Useful x 1
  6. Ok what if we remove the code which checks whether it is JDK 16 And then compile the code and run it!
     
  7. md_5

    Administrator Developer

    You'd have to recompile all the Mojang code too (a difficult task), not just the Spigot classes
     
    • Useful Useful x 1
  8. The question is why is the Bukkit/Spigot-API still compiled against 8, same for Spigot? You need to run with jre 16 anyways.
     
    • Like Like x 1
  9. Yaa also the ide shows 4000+ errors against jre8
     
  10. Better to just use the --release option when compiling instead of -source and -target. --release will cause a compiler error if the code uses any standard api introduced in a later jdk release than the release specified in the argument.
    What's so difficult about this? This code is already decompiled, no?
     
    #10 Jannyboy11, Jul 18, 2021
    Last edited: Jul 18, 2021
  11. Why is it so difficult to just... use java 16?