Reputation: 130
I am working on my Minecraft mod, and I would like to use a switch statement with a string in it. However, Minecraft's Gradle setup is set to compile against Java 6, which does not support switch statements on strings. How do I change what Minecraft's Gradle is compiling against?
Thank you!
EDIT:
After looking at the "similar" question, I am still stuck. Because this is a Minecraft Forge Gradle project, this is a bit different. I do not have a gradle.properties file.
I also the other popular method of fixing this:
compileJava.options.fork = true compileJava.options.forkOptions.executable = /path_to_javac
However, Gradle refused my path due to the ':' character, and I cannot get specify a path without it to my knowledge. Are there any other options? Or am I going to have to live in Java 6?
Thank you!
Upvotes: 0
Views: 1830
Reputation: 870
Be aware that Minecraft Forge installation docs state that it officially supports Java 6 and 7, but it should be backwards compatible.
Install Java 8 Standard Edition SDK and set your JAVA_HOME
environment variable to point to the path in which you installed it.
The build.gradle
file may have a property sourceCompatibility
. If it doesn't or is set incorrectly, set it like so:
sourceCompatibility=1.8
If you are using an IDE, you will need to make sure that it is also aware that it can expect java 1.8 source.
Upvotes: 2