I was wondering if I can use Java 11 or higher JRE and JDK for Minecraft modding, I have always used Java 8 but just recently I updated my Eclipse IDE and it now requires Java 11 or higher to be able to use. So can I use Java 11 or higher, or should I just have both of them?
As far as I've seen on say Curseforge many go up to about 9 or 10 I think.
And as low as 8 maybe 7 (obviously older for older Forge versions).
I'm no Dev but my guess is maybe but I don't think it's common or it's just not a possible thing (one of the two).
I assume documentation for Forge would explain what is supported (just thought I'd look around and I think I found it, took a bit to find compared to Fabric's which is really easy on their wiki) that would be and I too haven't come across this information when watching Forge Dev tutorials come across this information (when I have tried out of curiosity with my limited Java knowledge).
It's worth giving a go in a dev environment I guess but probably using older than 11 is likely I'd assume.
Also something to point out if your considering newer versions of Minecraft (1.13+, 1.12.2 and below it's not related) is to learn datapacks as many things like recipes or other features can be useful with them. These are a mix of Java and Minecraft commands as far as I know. I'd say if you want to do modding for 1.12.2 that info may be still out there but the Forge team don't support/update it anymore so keep that in mind.
I'd say best to ask in the Forge IRC/Forge Forums https://forums.minecraftforge.net/ to get a better answer if no one else responds on here.
Thanks for replying I looked into it bit more and I think I figure out a little on how Eclipse and the Forge build use the Java JRE and JDK. I ended up with having to use both Java 8 and 11 since my Eclipse wouldn't start without Java 11. I could have delete Java 8 and just had 11 but I kept it because Java 8 is Minecraft's default and I believe if I coded my mods in Java 11 it would require people to also get it if I used any features that are in 11 and not in 8. Anyways it all seems to work normal since I can use Java 8 in my Eclipse workspace as I used it to before.
Note that I'm not really sure if my thinking is right since I didn't see a mod that was on a higher Java version that had problems with a older version that I could have tested.
Specifically, "-source 1.6 -target 1.6" tells the compiler to treat the source as if it is only compatible with Java 6 and produce class files which likewise only have Java 6 bytecode and have a corresponding version stamp, even if the compiler itself is for a newer version. For example, I've gotten errors like the following when compiling (due to a coding error, not because I tried to do something that wasn't supported, "getVariant" returns an int, the real issue is that "par1Entity" was of the wrong type):
18:23:35 - src\minecraft\net\minecraft\src\RenderSilverfishTMCW.java:36: error: strings in switch are not supported in -source 1.6
18:23:35 - switch (par1Entity.getVariant())
18:23:35 - ^
18:23:35 -
18:23:35 - (use -source 7 or higher to enable strings in switch)
You can easily change this by editing a configuration file, I have no idea how Forge's development environment works but MCP has a configuration file (mcp\conf\mcp.cfg) with all the command-line arguments (it should default to Java 8 for newer versions, which require this at a minimum; I've never changed it since I've never had any need to).
I was wondering if I can use Java 11 or higher JRE and JDK for Minecraft modding, I have always used Java 8 but just recently I updated my Eclipse IDE and it now requires Java 11 or higher to be able to use. So can I use Java 11 or higher, or should I just have both of them?
As far as I've seen on say Curseforge many go up to about 9 or 10 I think.
And as low as 8 maybe 7 (obviously older for older Forge versions).
I'm no Dev but my guess is maybe but I don't think it's common or it's just not a possible thing (one of the two).
I assume documentation for Forge would explain what is supported (just thought I'd look around and I think I found it, took a bit to find compared to Fabric's which is really easy on their wiki) that would be and I too haven't come across this information when watching Forge Dev tutorials come across this information (when I have tried out of curiosity with my limited Java knowledge).
It's worth giving a go in a dev environment I guess but probably using older than 11 is likely I'd assume.
Also something to point out if your considering newer versions of Minecraft (1.13+, 1.12.2 and below it's not related) is to learn datapacks as many things like recipes or other features can be useful with them. These are a mix of Java and Minecraft commands as far as I know. I'd say if you want to do modding for 1.12.2 that info may be still out there but the Forge team don't support/update it anymore so keep that in mind.
I'd say best to ask in the Forge IRC/Forge Forums https://forums.minecraftforge.net/ to get a better answer if no one else responds on here.
Niche Community Content Finder, Youtuber, Modpack/Map Maker, Duck
Forum Thread Maintainer for APortingCore, Liteloader Download HUB, Asphodel Meadows, Fabric Project, Legacy Fabric/Cursed Fabric, Power API, Rift/Fabric/Forge 1.13 to 1.17.
Wikis I Maintain: https://modwiki.miraheze.org/wiki/User:SuntannedDuck2
Thanks for replying I looked into it bit more and I think I figure out a little on how Eclipse and the Forge build use the Java JRE and JDK. I ended up with having to use both Java 8 and 11 since my Eclipse wouldn't start without Java 11. I could have delete Java 8 and just had 11 but I kept it because Java 8 is Minecraft's default and I believe if I coded my mods in Java 11 it would require people to also get it if I used any features that are in 11 and not in 8. Anyways it all seems to work normal since I can use Java 8 in my Eclipse workspace as I used it to before.
Note that I'm not really sure if my thinking is right since I didn't see a mod that was on a higher Java version that had problems with a older version that I could have tested.
You can compile mods for an older version of Java without needing a JDK for that version; I use MCP for 1.6.4 and it is set to compile for Java 6:
Specifically, "-source 1.6 -target 1.6" tells the compiler to treat the source as if it is only compatible with Java 6 and produce class files which likewise only have Java 6 bytecode and have a corresponding version stamp, even if the compiler itself is for a newer version. For example, I've gotten errors like the following when compiling (due to a coding error, not because I tried to do something that wasn't supported, "getVariant" returns an int, the real issue is that "par1Entity" was of the wrong type):
You can easily change this by editing a configuration file, I have no idea how Forge's development environment works but MCP has a configuration file (mcp\conf\mcp.cfg) with all the command-line arguments (it should default to Java 8 for newer versions, which require this at a minimum; I've never changed it since I've never had any need to).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?