Java 16 not working?

I am trying to make a fabric mod, but I cannot even start, as for some reason, when I launch vscode, it comes up with this error:

 {
	"resource": "/C:/Users/USERNAME/Documents/mod/build.gradle",
	"owner": "_generated_diagnostic_collection_name_#2",
	"code": "0",
	"severity": 8,
	"message": "Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.0.2-bin.zip'.\r\nBuild file 'C:\\Users\\USERNAME\\Documents\\mod\\build.gradle' line: 2\r\nAn exception occurred applying plugin request [id: 'fabric-loom', version: '0.8-SNAPSHOT']\r\nFailed to apply plugin 'fabric-loom'.\r\nYou are using an outdated version of Java (15). Java 16 or higher is required.\nThe JAVA_HOME environment variable is currently set to (C:\\Program Files\\Java\\jdk-16.0.1).",
	"source": "Java",
	"startLineNumber": 2,
	"startColumn": 1,
	"endLineNumber": 2,
	"endColumn": 1
}

It says I am using Java 15, when I have Java 16.0.1 installed.

2 Likes

Whatever you use to start Gradle starts it with Java 15.
I guess you run Gradle through some VSC integration?
Then check whether there you can somehow select which version is used to start Gradle.
Gradle 7+ is fully compatible with Java 16.

It says im using java 11 but I have 16 installed

Who is “it”? How do you start Gradle? From IDE? From command line? …?

I got the same problem. I’m using gradle in vscode. It says I’m using Java 8 but I have Java 17 installed and set in the settings.