I had a bit of a drama trying to upgrade Java to the current version of the Minecraft server (v1.18) because the server was originally running Ubuntu 19.x, so I changed to Ubuntu 20.04 after finding a location where I could update all the packages and do the work.
After that, I installed the JRE, and this is the same command that displays the current version:
mortimer@mineraft:/home/minecraft$ sudo apt-get install default -jre Reading package lists... Done Building dependency tree Reading state information... Done default -jre is already the newest version (2: 1.11 - 72). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
The same with the JDK:
mortimer@mineraft:/home/minecraft$ sudo apt-get install default -jdk Reading package</span> lists... Done Building dependency tree Reading state information... Done default -jdk is already the newest version (2:1.11-72). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mortimer @mineraft:/home/minecraft$ sudo update-alternatives --config java There are 4 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 3 /usr/lib/jvm/jdk-16.0.1/bin/java 0 manual mode * 4 /usr/local/java/jre1.8.0_311/bin/java 1 manual mode Press <enter> to keep the current choice[*], or type selection number:
When I execute my Q&D start command, however:
mortimer@mineraft:/home/minecraft$ cat start.sh #!/bin/bash sudo java -Xmx6G -Xms4G -jar /home/minecraft/spigot-1.18.jar nogui > /dev/console
The server sends me a beautiful error message that says:
mortimer@mineraft:/home/minecraft$ sudo ./start.sh Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: org/bukkit/craftbukkit/bootstrap/Main has been compiled by a more recent version of the Java Runtime(class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418>) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601) mortimer@mineraft:/home/minecraft$
That is my Jave version:
mortimer@mineraft:/home/minecraft$ java -version java version "1.8.0_311" Java(TM) SE Runtime Environment(build 1.8.0_311-b11) Java HotSpot(TM)64-Bit Server VM(build 25.311-b11, mixed mode) mortimer@mineraft:/home/minecraft$
Any help will be appreciated. Thanks!
Troubleshooting Java on Ubuntu 20.04 for Minecraft 1.18
Minecraft is a popular game that requires Java to run. As such, it’s important to ensure that your Java installation is up-to-date and compatible with the latest version of Minecraft. However, updating Java on Ubuntu 20.04 for Minecraft 1.18 can be a bit tricky. In this post, we’ll discuss some common issues that users may encounter when trying to update Java for Minecraft on Ubuntu 20.04 and provide some troubleshooting tips.
1. Checking the Current Java Version
Before we dive into troubleshooting, it’s important to ensure that you have the correct version of Java installed. To check the current version of Java installed on your Ubuntu 20.04 system, you can use the following command in the terminal:
This will display the current version of Java installed on your system. If you don’t have Java installed, you can install it using the following command:
sudo apt-get install default-jre
2. Updating Java to the Latest Version
If you have an older version of Java installed on your system, you may need to update it to the latest version to ensure compatibility with Minecraft 1.18. To update Java to the latest version, you can use the following command in the terminal:
sudo apt-get update sudo apt-get upgrade
This will update all of the packages on your system, including Java. Once the update is complete, you can check the current version of Java using the
java -version command.
3. Checking the Java Path
After updating Java to the latest version, you may need to ensure that Minecraft is using the correct version of Java. To check the Java path, you can use the following command in the terminal:
This will display the path to the Java executable. If you have multiple versions of Java installed on your system, you may need to ensure that Minecraft is using the correct version.
4. Using the Correct Java Arguments
When starting the Minecraft server, you may need to use specific Java arguments to ensure that it runs smoothly. The
-Xmx argument specifies the maximum amount of memory that the server can use, while the
-Xms argument specifies the initial amount of memory that the server will use. For example, the following command starts the Minecraft server with 6GB of maximum memory and 4GB of initial memory:
java -Xmx6G -Xms4G -jar minecraft_server.jar nogui
5. Troubleshooting Java Issues
If you’re still experiencing issues with Java on Ubuntu 20.04 for Minecraft 1.18, there are a few additional troubleshooting steps that you can take. First, you can try uninstalling and reinstalling Java using the following commands:
sudo apt-get remove default-jre sudo apt-get autoremove sudo apt-get install default-jre
This will completely remove Java from your system and reinstall it. You can then check the current version of Java and try running the Minecraft server again.
If you’re still experiencing issues, you can try installing a different version of Java. For example, you can install OpenJDK 8 using the following command:
sudo apt-get install openjdk-8-jre
You can then check the current version of Java and try running the Minecraft server again.
Updating Java on Ubuntu 20.04 for Minecraft 1.18 can be a bit tricky, but with the right troubleshooting steps, you can ensure that your Minecraft server runs smoothly. By checking the current version of Java, updating to the latest version, checking the Java path, using the correct Java arguments, and troubleshooting Java issues, you can get your Minecraft server up and running in no time.
It looks like you have successfully installed the Java Runtime Environment (JRE) and the Java Development Kit (JDK) on your Ubuntu 20.04 system. The
update-alternatives command is used to set the default version of Java that is used on the system.
To verify that you have the correct version of Java installed for your Minecraft server, you can check the version by running the
java -version command. This should output the version of Java that is currently being used by the system.
In order to use a specific version of Java with your Minecraft server, you will need to set the
JAVA_HOME environment variable to point to the installation directory of the desired version of Java. You can do this by adding the following line to your
You will need to replace
/path/to/java/installation with the actual path to the Java installation on your system. You can also set this variable in the script that starts your Minecraft server.
Once you have set the
JAVA_HOME environment variable, you should be able to use the desired version of Java with your Minecraft server. You can verify that the correct version is being used by checking the output of the
java -version command when the server is running.
It’s important to keep your system and software up to date in order to ensure that you are using the most stable and secure versions. Updating Java on your Ubuntu 20.04 system for use with your Minecraft server should be a relatively straightforward process as long as you follow the steps outlined above.
Make sure to double check the version of Java that you have installed and verify that it is compatible with your Minecraft server. If you are having any issues or errors, it may be helpful to consult the documentation or seek additional assistance.
If you want to run Minecraft: Java Edition version 1.18, you need Java 17 installed on your system. If Java is only used for Minecraft, you can remove your current Java version by running the following commands in the terminal:
sudo apt remove default-jre default-jdk sudo apt autoremove
After uninstalling Java, you can install OpenJDK 17 by running the following commands:
sudo apt update sudo apt install openjdk-17-jre
It’s worth noting that we don’t install the JDK because it’s used for compiling Java programs, and you won’t need it to run Minecraft. Finally, you can check the table to verify the corresponding Java version required for different Minecraft versions:
|Minecraft Version||Java Version|