Java 9 Support (after Release)?

sorry for my bad english.

I follow Java 1.9. it contains many interesting Features (JDK 9)

But I worried about the Classloader changes: JEP 238: Multi-Release JAR Files (mixin, asset, …)
I would like to know if I can use Java 1.9 (after Release) with Sponge…

Java is backwards compatible. A Java program written for Java 1.0 will run just fine on a Java 9 JVM. So long as you don’t use any Java 9-specific features, then your program will be compatible with other Java 8 programs, including Sponge, on any JVM that both will run on.

1 Like

Ok~, but I will use Java 1.9 Features in my Plugins :blush:
Or with other words, I use 1.9 JDK and I work consciously with 1.9 Features (Other Projects)
Now I switch to Sponge and I miss Features from 1.9 → Can I wait for Java 9 support or I have to work with workarounds

Well, which Java 9 features do you intend to use, and how will the Java 9 JDK improve your plugins?

And you must also keep in mind that not many people will have Java 9 installed, meaning that all of your plugins compiled for Java 9 will be incompatible with their JVMs.

Using the jigsaw module system will definetely not work with sponge/forge/minecraft due to class loading changes. However, the module system is optional - you can still create a program using java 9 api and run that with the same command as you would have used in java 8, and it will work. So there is no reason not to use java 9 api features, just keep in mind that you can’t use modules (and why would you, honestly? the module system is kinda useless)

Thanks pie_flavor and xfel,
I switch my Server from Spigot to Sponge, isn’t my goal to public the Plugins.

I will use:

If I understand xfel right, I can use this (Only API)
I dosn’t understand the Module System, but it isn’t important.

Just saying, number 269 is useful if you’re not using Guava, but Sponge does, which has useful methods like ImmutableList.of() or ImmutableMap.of() or whatever.

This is common misconception between many java developers, its not true at all. “It may compile”, and it “may be functional”

Mainly, due to the overhaul of how class loaders work under project jigsaw, Minecraft itself will need to be updated for Java 9, after which, the entire toolchain for Forge/Sponge, etc. will have to be updated.


…Will it at least work on Java 9 if Minecraft (and all mods) still target Java 8 or earlier?

Only in super duper edge cases will the code not compile or not crash. Certainly no regular Sponge plugin would be unable to be upwards compatible.

Put it this way, you can’t even run Gradle on Java 9 at the moment, due to the huge changes in modularity of the JVM. And with that, if Sponge moves forward to Java 9, that wouldn’t necessarily break smaller plugins, it would certainly require plugins make the move to Java 9’s module system and update plugin dependencies etc.

It is going to be an interesting two years.


Really? I thought you could just leave everything in the default module and it would work like normal.

I think I heard somewhere that AppClassLoader no longer extends URLClassLoader in Java 9, that alone with break many applications that assume the ACL is a URLClassLoader.