Skip to content
LordOfWizard edited this page Oct 3, 2021 · 4 revisions

Changing Java Version on mcserver

first check what versions of java are installed on your computer.. mainly java 8, java 11 are installed on debian buster... check them by this command.

sudo update-alternatives --config java

It will give you bunch of output something like this

There are 2 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                            Priority   Status------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode* 
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
Press <enter> to keep the current choice[*], or type selection number:

Now for java 8 type 2 and then press enter. and now comes the next part do this command
(BEFORE THAT CHECK YOU ARE IN ~/mcserver directory.)
nano startJavaServer then it will open up a file.. it should look something like this file....
Change it to look something like this\

#!/bin/bash
export MAIN_DIR=$PWD
export JAVA=$MAIN_DIR/bin/java_bins/bin/java
cd server

#uncomment this below line only if the server you are running is 1.17+ (if it is uncommented by default keep it as it is).
#$JAVA -Xmx28G -Xms15G -jar server.jar nogui
# for 1.16 or lower uncomment this line
java -Xmx28G -Xms15G -jar server.jar nogui

basically change the # infront of some lines that's all. EASY RIGHT?
gif

Clone this wiki locally