Closed felixtech-msp closed 2 years ago
What is your %PATH%
? I suspect you have a case where JAVA_HOME
points to Java 18 but PATH
points to Java 1.8. This could possibly cause trouble?
Also: it's not "building" for Forge/Fabric - it's only running the configure stage. There are options in newer Gradle versions to skip configuring unrelated projects but we're not using them yet.
In PATH
the C:\Program Files\Common Files\Oracle\Java\javapath
folder is referenced. No other Java related stuff is in PATH
. I confirmed that this references JDK 18. Also in a regular cmd java -version
outputs java version "18.0.1.1" 2022-04-22
. Calling javac -version
outputs javac 18.0.1.1
.
I was also able to reproduce the issue on a different machine with JDK 17 and JRE 8 installed and where JAVA_HOME
referenced the JDK 17 and javapath
is also in PATH
and java -version
shows java version "17.0.1" 2021-10-19 LTS
.
I also tested building in a Docker container on Ubuntu which works fine. I'd say for reliable building a reliable OS is recommended.
My recommendation would be to not use C:\Program Files\Common Files\Oracle\Java\javapath
in PATH
but instead directly reference the correct JRE/JDK's bin
folder. I have built with this setup under Windows many times. Another possibility is that Oracle Java is somehow different from Adoption that I've been using?
i don't think building a java project using a jre is a good idea, he should use a jdk (java developing kit), jre (java runtime environment) is used to just run java programs, also the error sais Please check that C:\Program Files\Java\jre1.8.0_321 contains a valid JDK installation.
, i think it's because it was on a jre, not jdk
if you had an error using a jdk, maybe it was just other error? can you send the error when using a jdk
I am building with JDK (JRE doesn't even have javac so it wouldn't even work. The whole issue I'm reporting is that Gradle is started with JDK and runs on it and in the middle it wants to switch to a JRE it shouldn't use or even know that it's there. Outputting different paths from gradlew.bat showed me even that everything is started with JDK. I was completely unable to find out where any why Gradle switches to JRE, otherwise I would have said where it does that.
he didn't start to compile the project (would be :compileJava or similar), so the fact that it doesn't have javac doesn't change anything, did you check both user environment variables and system environment variables (in both of them check both path
and java_home
) doesn't have java 8?
Please try building without C:\Program Files\Common Files\Oracle\Java\javapath
in PATH
and report back.
Project builds fine in multiple other environments - this is a developer specific condition, so I'm removing the 'Bug' marker: it's not a bug in the code, and as a problem it doesn't affect anyone with a correctly defined build environment.
No response, closing issue. Please reopen if you still have trouble building after doing https://github.com/webbukkit/dynmap/issues/3787#issuecomment-1171088220.
Issue description: Project cannot be built as Grandle changes from JDK to JRE during the build and fails. Also building for Spigot triggers something completely else. And Gradle config seems to be broken.
Environment: OS: Windows 10 21H2 JDK: Oracle Java SE Development Kit 18.0.1.1 (64-bit) %JAVA_HOME% is set to C:\Program Files\Java\jdk-18.0.1.1 Gradle is run with the JDK (checked in gradlew.bat)
Steps to reproduce:
Expected behaviour: build Dynmap for Spigot
Actual behaviour: When running the command "gradlew :spigot:build" it does not build for Spigot at all. Instead it builds first for Fabric then for Forge (versions ascending) and building for Forge 1.19 dies as Gradle wants to use the JRE to build (which it doesn't for the previous Forge versions).
Full build output seen below:
Conclusion: Either the Gradle config is broken or the instructions on how to build are wrong or incomplete.