MCreator ignores changes to JAVA_HOME

Status
Fixed
Type
Product/platform
MCreator/Linux
Priority
Normal
Issue description

I opened an issue for this a day or two ago, and i was advised to download the Java 8 JDK, which i have since done. I assumed i had gotten everything working, changed JAVA_HOME to direct to the JDK etc. then i started MCreator the next day, after getting the issue closed since i assumed everything would work fine.

the problem i'm experiencing is MCreator is completely ignoring the changes i've made to JAVA_HOME. doing either "$JAVA_HOME" or "echo $JAVA_HOME" will display the new target directory of "/usr/lib/jvm/java-1.8.0-openjdk-amd64". but the MCreator console says it still thinks JAVA_HOME points to "/usr/lib/jvm/java-8-openjdk-amd64/jre".

I know i shouldn't have gotten my previous issue closed so i could just have stayed on that one so, sorry in advance for opening a new one.

 

https://pastebin.com/UesXXDCJ the error log incase it's still of importance, the error is identical to beforehand.

Issue comments

How did you set the JAVA_HOME variable? You need to set in in the bashrc, as MCreator opens a new bash session for each Gradle build, and simply exporting the variable in the current session isn't enough.

I set JAVA_HOME with the command "sudoedit kate /etc/environment" (kate is my text editor) and put "JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"" into it. I wasn't aware i'd need to set it in the bashrc.

 

Do I just copy/paste what I put into /etc/environment or do i do something else to set this? looking it up it says i should put all of this into ~/.profile, and also put this in along with it:

"export PATH=$PATH:$JAVA_HOME/bin"

You need to export the JAVA_HOME pointing to the JDK installation. Put this export command in a new line in bashrc.

ok, so i've added both of these to ~/.bashrc, along with ~/.profile and /etc/environment just to be safe;

export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin

still getting the gradle error for whatever reason, i've reloaded all 3 profiles with the command "source <respective path>"

 

 

If this does not work, try going in the forge folder in MCreator, edit gradlew file in this folder and add this line to the top of the file:

JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"

Report back if it worked.

no, it hasn't worked. for some reason it deletes and reinstalls the forge FDK everytime i run MCreator, i don't really know why. is there a way to stop this behavior?

I had to do a reinstall because i messed up doing changes to ~/.bashrc and ~/.profile and forgot to do a backup, but after i reinstalled i redefined JAVA_HOME in /etc/environment.

Java works fine, and the result of the two commands is:

/usr/lib/jvm/java-1.8.0-openjdk-amd64

is this what the result should be?

I don't really understand all your complicated language, i got this error :
 

Executing gradle command: runClient
Microsoft Windows [version 10.0.17134.165]
(c) 2018 Microsoft Corporation. Tous droits r‚serv‚s.
C:\Users\MaŒtre\Desktop\MCREATOR 1.7.10\MCreator173>cd forge
C:\Users\MaŒtre\Desktop\MCREATOR 1.7.10\MCreator173\forge>SET "JAVA_HOME=C:\Users\Maître\Desktop\MCREATOR 1.7.10\MCreator173\jdk64\"
C:\Users\MaŒtre\Desktop\MCREATOR 1.7.10\MCreator173\forge>SET JAVA_EXE=%JAVA_HOME%\bin\java.exe
C:\Users\MaŒtre\Desktop\MCREATOR 1.7.10\MCreator173\forge>SET PATH=%JAVA_HOME%\bin\;%PATH%
C:\Users\MaŒtre\Desktop\MCREATOR 1.7.10\MCreator173\forge>gradlew -Dorg.gradle.jvmargs="-Xms625m -Xmx2048m" runClient
ERROR: JAVA_HOME is set to an invalid directory: C:\Users\Maître\Desktop\MCREATOR 1.7.10\MCreator173\jdk64\
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
C:\Users\MaŒtre\Desktop\MCREATOR 1.7.10\MCreator173\forge>
Task completed with return code 0 in 3453 millisecondsPath and JAVA HOME setting of my computer



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.