gradlew

im trying to turn my folder into a jar and my gradle is hard stuck on java 17 while i need java 21
108 Replies
JavaBot
JavaBot3mo ago
This post has been reserved for your question.
Hey @wr! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st3mo ago
How are you running Gradle? From the command line? Only your IDE? What is your JAVA_HOME? Do you have any toolchain configured in your build.gradle?
6ix
6ixOP3mo ago
im running gradle in cmd and idk what java_home is supposed to be / mean
dan1st
dan1st3mo ago
What is the output of echo %JAVA_HOME% in cmd? JAVA_HOME is an environment variable that points to the Java installation if set up Please also include the output of where java and where javac
6ix
6ixOP3mo ago
do i paste echo %JAVA_HOME% in cmd
dan1st
dan1st3mo ago
yes echo is a command that just prints everything coming after it
6ix
6ixOP3mo ago
C:\Users\name>echo %JAVA_HOME% %JAVA_HOME% C:\Users\name> this is what pops uip
dan1st
dan1st3mo ago
this means no JAVA_HOME is set
6ix
6ixOP3mo ago
look hold on one sec
dan1st
dan1st3mo ago
What is the output of where java and where javac? and javac --version
6ix
6ixOP3mo ago
where java C:\Program Files\Eclipse Adoptium\jdk-21.0.8.9-hotspot\bin\java.exe C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe where javac C:\Program Files\Eclipse Adoptium\jdk-21.0.8.9-hotspot\bin\javac.exe javac 21.0.8
dan1st
dan1st3mo ago
ok so how exactly do you see Gradle using the wrong Java version? Can you show your build.gradle file?
6ix
6ixOP3mo ago
FAILURE: Build failed with an exception. * What went wrong: The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot\bin\java.exe * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
PS C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4>
dan1st
dan1st3mo ago
ok There should be a program on Windows that you can use to edit environments Can you try typing "environment" in your start menu? It should show something like "Edit user environment variables"
6ix
6ixOP3mo ago
im there now what
dan1st
dan1st3mo ago
Add a new environment variable named JAVA_HOME and set the value to C:\Program Files\Eclipse Adoptium\jdk-21.0.8.9-hotspot that should tell Gradle where to find Java
6ix
6ixOP3mo ago
No description
6ix
6ixOP3mo ago
do i press enviroment variables ?
dan1st
dan1st3mo ago
I think you didn't open the program I meant but yes, if you click on Environment Variables... you should get to it How did you open that terminal?
6ix
6ixOP3mo ago
held down shit and right clicked in open space in the folder that has gradle
dan1st
dan1st3mo ago
ok
6ix
6ixOP3mo ago
and did .\gradlew.bat build in cmd
dan1st
dan1st3mo ago
yeah that's all I wanted to know you should be able to add the environment variable once you get to that menu
6ix
6ixOP3mo ago
press new right and what do i do here
No description
6ix
6ixOP3mo ago
No description
dan1st
dan1st3mo ago
yes variable name is JAVA_HOME and the value is C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot Actually can you show the contents of C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot? actually my fault the value should be C:\Program Files\Eclipse Adoptium\jdk-21.0.8.9-hotspot
6ix
6ixOP3mo ago
alr
6ix
6ixOP3mo ago
No description
dan1st
dan1st3mo ago
looks good now you should be able to close that cmd/PowerShell window, open it again and it should use JDK 21
6ix
6ixOP3mo ago
FAILURE: Build failed with an exception. * What went wrong: The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot\bin\java.exe * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
PS C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4>
dan1st
dan1st3mo ago
Is that with a new cmd window?
6ix
6ixOP3mo ago
yes
dan1st
dan1st3mo ago
Can you try echo %JAVA_HOME% in cmd?
6ix
6ixOP3mo ago
C:\Program Files\Eclipse Adoptium\jdk-21.0.8.9-hotspot
dan1st
dan1st3mo ago
Did you do that in the same cmd window as there?
6ix
6ixOP3mo ago
wdym
dan1st
dan1st3mo ago
Is that the window you executed the echo %JAVA_HOME% in?
6ix
6ixOP3mo ago
yea
dan1st
dan1st3mo ago
Can you show the build.gradle file?
6ix
6ixOP3mo ago
these all i got
No description
6ix
6ixOP3mo ago
No description
dan1st
dan1st3mo ago
then build.gradle.kts
Polar
Polar3mo ago
plugins {
id("fabric-loom") version "1.11-SNAPSHOT"
}

base {
archivesName = properties["archives_base_name"] as String
version = properties["mod_version"] as String
group = properties["maven_group"] as String
}

repositories {
maven {
name = "meteor-maven"
url = uri("https://maven.meteordev.org/releases")
}
maven {
name = "meteor-maven-snapshots"
url = uri("https://maven.meteordev.org/snapshots")
}
}

dependencies {
// Fabric
minecraft("com.mojang:minecraft:${properties["minecraft_version"] as String}")
mappings("net.fabricmc🧶${properties["yarn_mappings"] as String}:v2")
modImplementation("net.fabricmc:fabric-loader:${properties["loader_version"] as String}")

// Meteor
modImplementation("meteordevelopment:meteor-client:${properties["minecraft_version"] as String}-SNAPSHOT")
}

tasks {
processResources {
val propertyMap = mapOf(
"version" to project.version,
"mc_version" to project.property("minecraft_version"),
)

inputs.properties(propertyMap)

filteringCharset = "UTF-8"

filesMatching("fabric.mod.json") {
expand(propertyMap)
}
}

jar {
inputs.property("archivesName", project.base.archivesName.get())

from("LICENSE") {
rename { "${it}_${inputs.properties["archivesName"]}" }
}
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = 21
options.compilerArgs.add("-Xlint:deprecation")
options.compilerArgs.add("-Xlint:unchecked")
}
}
plugins {
id("fabric-loom") version "1.11-SNAPSHOT"
}

base {
archivesName = properties["archives_base_name"] as String
version = properties["mod_version"] as String
group = properties["maven_group"] as String
}

repositories {
maven {
name = "meteor-maven"
url = uri("https://maven.meteordev.org/releases")
}
maven {
name = "meteor-maven-snapshots"
url = uri("https://maven.meteordev.org/snapshots")
}
}

dependencies {
// Fabric
minecraft("com.mojang:minecraft:${properties["minecraft_version"] as String}")
mappings("net.fabricmc🧶${properties["yarn_mappings"] as String}:v2")
modImplementation("net.fabricmc:fabric-loader:${properties["loader_version"] as String}")

// Meteor
modImplementation("meteordevelopment:meteor-client:${properties["minecraft_version"] as String}-SNAPSHOT")
}

tasks {
processResources {
val propertyMap = mapOf(
"version" to project.version,
"mc_version" to project.property("minecraft_version"),
)

inputs.properties(propertyMap)

filteringCharset = "UTF-8"

filesMatching("fabric.mod.json") {
expand(propertyMap)
}
}

jar {
inputs.property("archivesName", project.base.archivesName.get())

from("LICENSE") {
rename { "${it}_${inputs.properties["archivesName"]}" }
}
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = 21
options.compilerArgs.add("-Xlint:deprecation")
options.compilerArgs.add("-Xlint:unchecked")
}
}
This message has been formatted automatically. You can disable this using /preferences.
dan1st
dan1st3mo ago
Can you show the content of C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot?
6ix
6ixOP3mo ago
No description
dan1st
dan1st3mo ago
ok so it seems you tried to uninstall that Can you run ./gradlew --stop in the project and then try again
6ix
6ixOP3mo ago
yh do i just open cmd or cmd in the file thing
dan1st
dan1st3mo ago
in the project so there
6ix
6ixOP3mo ago
PS C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4> ./gradlew --stop Stopping Daemon(s) 1 Daemon stopped PS C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4>
dan1st
dan1st3mo ago
now try again
6ix
6ixOP3mo ago
try what gradle build?
dan1st
dan1st3mo ago
yes
6ix
6ixOP3mo ago
u the goat daniel its downloading or wtv ❤️ Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details Calculating task graph as no cached configuration is available for tasks: build
Configure project :
Fabric Loom: 1.11.4 <-------------> 0% CONFIGURING [21s]
IDLE IDLE root project IDLE IDLE IDLE
dan1st
dan1st3mo ago
Gradle Forums
Gradle is trying to use a JDK that has been uninstalled from my system
I had the same issue and I removed .gradle folder from user and it worked perfectly
dan1st
dan1st3mo ago
You had a running Gradle daemon that was still referencing the old JDK The gradlew --stop commands stops all running Gradle daemons A daemon is a background process and Gradle uses daemons as an optimization as it can achieve better performance by using the same process for consecutive builds
6ix
6ixOP3mo ago
bruh BUILD FAILED in 1m 30s 3 actionable tasks: 3 executed Configuration cache entry stored. PS C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4>
dan1st
dan1st3mo ago
Can you show the full build log/output?
6ix
6ixOP3mo ago
dan1st
dan1st3mo ago
ok seems there are compilation errors
6ix
6ixOP3mo ago
y?
dan1st
dan1st3mo ago
Your code is not valid Java code
dan1st
dan1st3mo ago
These are errors in your Java code
dan1st
dan1st3mo ago
Did you decompile that code?
6ix
6ixOP3mo ago
jd-gui yea but i had permission from my friend who made the code he just told me to decompile it
dan1st
dan1st3mo ago
so your friend used an obfuscator which makes it hard to decompile/get useful stuff out of it this resulted in one class being named null or it's just an anonymous class and the decompiler couldn't deal with it null is not a valid name of a Java class
6ix
6ixOP3mo ago
💔 what now
dan1st
dan1st3mo ago
so you'd need to rename that class and the references to it and in wrESP2.java, there's a syntax error where a " is missing it should probably be info("Deepslate at " + pos.method_23854(), new Object[0]);
6ix
6ixOP3mo ago
is chatgpt correct on this
No description
6ix
6ixOP3mo ago
oh wow
dan1st
dan1st3mo ago
yeah it's a pretty obvious error
6ix
6ixOP3mo ago
cooked alr give me a sec to fixx
dan1st
dan1st3mo ago
the message literally tells you that the " is not closed
6ix
6ixOP3mo ago
which file is it in cause i looked in wresp2.java didnt see it nvm i was in wrong one info("Deepslate at" + pos.method_23854(), new Object[0]); like this?
dan1st
dan1st3mo ago
yeah should be fine though you probably want a space between at and the closing "
6ix
6ixOP3mo ago
alr
dan1st
dan1st3mo ago
it would be the difference between Deepslate at123 and Deepslate at 123
6ix
6ixOP3mo ago
info("Deepslate at " + pos.method_23854(), new Object[0]); wait one sec it didnt copy correct info("Deepslate at " + pos.method_23854(), new Object[0]);
dan1st
dan1st3mo ago
and I think the , new Object[0] is technically unnecessary (but not incorrect) if the method is using varargs
6ix
6ixOP3mo ago
no idea my friend js said to decompile his addon then copy and paste the coding and rebrand the meteor client addon for minecraft i only know a littel about coding but what other errors is there or was that it
dan1st
dan1st3mo ago
idk what your decompiler did but it seems like your friend used an obfuscator making it difficult to decompile and make sense of the code mainly the latter
6ix
6ixOP3mo ago
what do i do now then
dan1st
dan1st3mo ago
fix the errors I guess?
6ix
6ixOP3mo ago
ok can u like pinpoint them for me 😭 like file - fix
Polar
Polar3mo ago
chat gpt said
class null {
to replace with
class StashFinder$1 extends TypeToken<List<StashFinder.Chunk>> {}
class null {
to replace with
class StashFinder$1 extends TypeToken<List<StashFinder.Chunk>> {}
This message has been formatted automatically. You can disable this using /preferences.
dan1st
dan1st3mo ago
yes you'd need to change the null to something else there but I'm not 100% sure whether $1 is allowed there you'll see
6ix
6ixOP3mo ago
alright thanks for the help 🫡
JavaBot
JavaBot3mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
6ix
6ixOP3mo ago
ima be back if tho if $1 dont work
dan1st
dan1st3mo ago
sure
6ix
6ixOP3mo ago
No description
6ix
6ixOP3mo ago
can i just do this file by file
Task :compileJava FAILED
C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\modules\StoneESP.java:64: error: unclosed string literal info("Stone at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\modules\wrESP.java:84: error: unclosed string literal info("Rotated deepslate at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\modules\wrESP2.java:183: error: unclosed string literal info("Deepslate at + pos.method_23854(), new Object[0]); ^ 3 errors [Incubating] Problems report is available at: file:///C:/Users/anton/OneDrive/Desktop/meteor-wr-addon-1.21.4/build/reports/problems/problems-report.html FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'.
Compilation failed; see the compiler output below.
C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\modules\StoneESP.java:64: error: unclosed string literal info("Stone at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\modules\wrESP.java:84: error: unclosed string literal info("Rotated deepslate at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\modules\wrESP2.java:183: error: unclosed string literal info("Deepslate at + pos.method_23854(), new Object[0]); ^ 3 errors * Try:
Check your code and dependencies to fix the compilation error(s) Run with --scan to get full insights.
BUILD FAILED in 819ms 3 actionable tasks: 1 executed, 2 up-to-date Configuration cache entry reused. PS C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4> i fixed all of it and its still showing up wrong i fixed it all using notepad++
dan1st
dan1st3mo ago
no null is probably used in many other places
6ix
6ixOP3mo ago
cooked
dan1st
dan1st3mo ago
same issue with the missing " as it seems
6ix
6ixOP3mo ago
^
dan1st
dan1st3mo ago
ah ok
6ix
6ixOP3mo ago
what do i do now look
6ix
6ixOP3mo ago
No description
dan1st
dan1st3mo ago
Does it build successfully?
6ix
6ixOP3mo ago
no this is after i fixed everything
dan1st
dan1st3mo ago
that still means you have the issues with the missing " in wrESP2
6ix
6ixOP3mo ago
or could it be this "Rotated deepslate at " shouldnt there be a space on both sides
dan1st
dan1st3mo ago
yes
6ix
6ixOP3mo ago
bruh 💔 i gotta do that for every file
dan1st
dan1st3mo ago
Why did your friend hive you the binaries to decompile? instead of giving you the actual code they use
6ix
6ixOP3mo ago
cause he wants to be a gatekeeper and not just hand out the source code 💔 wait daniel my friend said its the mappings everytime i edit the notepad++ stuff should i .\gradlew.bat clean .\gradlew.bat build i did taskkill /f /im java.exe then .\gradlew.bat build and this happened Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details Calculating task graph as no cached configuration is available for tasks: build
Configure project :
Fabric Loom: 1.11.4 :remapping sources
Task :compileJava FAILED
C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\addon\modules\StoneESP.java:64: error: unclosed string literal info("Stone at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\addon\modules\wrESP.java:84: error: unclosed string literal info("Rotated deepslate at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\addon\modules\wrESP2.java:183: error: unclosed string literal info("Deepslate at + pos.method_23854(), new Object[0]); ^ 3 errors [Incubating] Problems report is available at: file:///C:/Users/anton/OneDrive/Desktop/meteor-wr-addon-1.21.4/build/reports/problems/problems-report.html FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'.
Compilation failed; see the compiler output below.
C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\addon\modules\StoneESP.java:64: error: unclosed string literal info("Stone at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\addon\modules\wrESP.java:84: error: unclosed string literal info("Rotated deepslate at + pos.method_23854(), new Object[0]); ^ C:\Users\anton\OneDrive\Desktop\meteor-wr-addon-1.21.4\src\main\java\wr\addon\modules\wrESP2.java:183: error: unclosed string literal info("Deepslate at + pos.method_23854(), new Object[0]); ^ 3 errors BUILD FAILED in 23s 3 actionable tasks: 3 executed
dan1st
dan1st3mo ago
oh I didn't know you got access to them well you still have the same issue with quotes
JavaBot
JavaBot3mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?