What java version should we use for plugins?

I was messing arround a bit. And noticed that a lot of libraries are using java 8 :frowning:.
I also have seen sponge plugins (especially here) that are targeting java 8.

So yeah I am bit confused right now :stuck_out_tongue:. I am still using 7 actually.

1 Like

From the SpongeDocs

We recommend using Java 7 for development. If you are adventurous, Java 8
is an option; however, many Minecraft servers have not yet migrated to
Java 8. Avoid using Java 6, as Java 6 is outdated.

HTH. HAND.

4 Likes

This is not really correct. It should really read something like:

Using java 6 should generally be avoided. However you should use Java 6 where you wish your plugin to work in all environments, since there is still a small but significant portion of end users who have not updated.

Our entire reason for targetting Java 6 with the sponge implementation (and this is the case for other incumbent technology such as FML and Forge) is that there is still a large enough user base on Java 6 to make it impossible to ignore. If there were some awe-inspiring new feature in Java 7 that made a strong technological argument for upgrading then it would be different, but the bulk of Java 7’s features were only syntactic sugar anyway and thus we don’t really lose anything by sticking with 6.

In essence. Target Java 8 if you don’t care who can run your code, Java 7 if you want most people to be able to run your code, and Java 6 if you want the overwhelming majority to be able to run your code.

5 Likes

As Mojang is phasing out Java 6 i would go with Java 7. Mumfrey has made a valid point nontheless.

2 Likes

Thanks for that clarification. I’ll amend that page shortly.
There was considerable (internal) debate over what we said about recommended Java versions. It came down to Java 7 being the most popular amongst the developers, and Java 6 reaching the end-of-line.
Moreover, Oracle says that Java 6 is “not updated with the latest security patches and is not recommended for use in production”. Make of that what you will.

The point is that from a user’s point of view, yes newer is better because security, etc. From a developer’s point of view, it all comes down to who you want to support.

Since there is absolutely nothing stopping you running JRE8 for general use but having JDK6 installed for building plugins (no security issue because the newer, still-supported JRE is the one that is actually used to run anything) there’s no reason to not build plugins against Java 6 and unless you actually need Java 8 features I’d go as far as to say I’d actually recommend it. It simply makes your plugin more likely to work everywhere.

3 Likes

Java 8 for my own, private plugins. Java 6 for plugins that are being released publicly. That’s how I do it, anyways.

3 Likes

I figure now that Java 7 is now no longer receiving updates it’s time for Java 8 to shine :smile:

2 Likes

Maybe so, but people will still take awhile to update everything

1 Like

My school computers are locked at Java 6…

Mines are locked to java 7 update 55