Start bat file with specefic java version

Discussion in 'Spigot Help' started by m69hansen, Jun 14, 2021.

  1. After I started a minecraft server with 1.17 and now there seems to be some problems with the older minecraft versions.
    I have multiple servers all the way from 1.12 to 1.16.5 connect to a hub server. They use version jre-8u291.

    The new minecraft use Java 16 developer version to run.
    This means that my other minecraft servers wont start duo the java version is supportet.

    Is there any way I can write a line in the start bat file, that a specific java version should be used for older versions of minecraft servers?

    exsample of my start bat file.

    @Echo off
    title Server Console
    java -Xmx1024M -Xms1024M -jar ServerFile.jar
    PAUSE


    I hope there are some who have a solution for this problem.
     
  2. SteelPhoenix

    Moderator

    instead of java use path/to/bin/java for the installation you want to use
     
  3. Like this?

    @Echo off
    title Server Console
    C:\Program Files\Java\jre1.8.0_291\bin\java -Xmx1024M -Xms1024M -jar ServerFile.jar
    PAUSE
     
  4. Resolved, just writed this:

    @Echo off
    "C:\Program Files\Java\jdk-11.0.7\bin\java.exe" -Xmx1024M -Xms1024M -jar C:\Users\vespu\Desktop\Server\paper-220.jar nogui
    pause
     
  5. Strahan

    Benefactor

    I would update that to:
    Code (Text):
    @echo off
    c:
    cd "\users\vespu\desktop\server"
    "C:\Program Files\Java\jdk-11.0.7\bin\java.exe" -Xmx1024M -Xms1024M -jar paper-220.jar nogui
    pause
    Because as you include "pause" in there, I assume you want to run it by just double clicking it. If the batch were to be moved to a location other than the server folder, the one you had before would start to generate files in whatever path it was in, not the server folder.