How to Create a Self Hosted Minecraft Java Server (Plus Mods)

Learn to Create a Vanilla Server or a Modded Forge Server


Making a Minecraft server on Java is way more difficult than making one on Bedrock edition. That being said, it comes with more flexibility, and more importantly, the potential for mods!


Prerequisites: 

 

The Vanilla Server

Minecraft Java edition doesn't just have a server built in, so you have to download their server software, and run it using a certain method.

  1. You can find it by googling "Minecraft 1.x.x" and scrolling to the bottom of the release page where it gives you the server download, or create a new installation for your version and using the launcher to download it. Put the server file in a blank new folder.

  2. Now open Command Prompt (CMD), and type java -version. If you downloaded Java 21, it might say something like "openjdk version "21.0.1" 2023-10-17 LTS"

    • If you've downloaded multiple java versions, you might have to adjust your Path and sometimes Java Home variable in Environment Variables to get the right java version. This sometimes can be just as simple as editing the Path variable, finding the right java version, and selecting "move up" until it has higher priority over the other ones. And then restart CMD.

      I have 4 Java versions and I have to cycle them to the top depending on which one I need.

  3. Go to the server folder location in command prompt with cd <folder path>. For example, cd C:\Users\Aengus\server_folder. Now we need to open the server file. use the command: java -jar <server.jar> where <server.jar> is the name of the server. It should tell you that it failed because you need to accept the Eula.

  4. In the folder, you should now see a bunch of new files. One of them should be the eula.txt file. You just have to open it and change eula=false to eula=true. Then run the java -jar server.jar command once more and it will start serving it for real.

    After accepting the EULA, you can run it again for real.

  5. You can join you world on the same computer by launching the desired Minecraft version, going to multiplayer, direct connect, and typing in 127.0.0.1, which allows your computer to connect to its own server. To allow other players to join, find your computer's IP address (and preferably make it static), and set up port forwarding so that port 25565 is forwarded to your computer. Then they can go to direct connect and type in your public IP address and they will connect to your computer.

That's it! You can change the world name and difficulty in the server.properties file (its a hidden file by default). Otherwise the world is just the "world" folder and you can download custom worlds and paste their contents into there and mess around with that. I'd also like to mention that you can change the flags when running the server to allocate more or less ram, hide the gui, and other things, but its also fine as it is.

The Modded Server

The modded server works almost the same way as the regular server, but uses a Forge server instead. For this, make new empty folder.

Pro tip: Curseforge is not the same as Forge. Curseforge is a platform for finding mods for Forge.

  1. Look up Forge Minecraft and download the version you want. To run the downloaded jar file, go to the downloads folder in command prompt, and then run java -jar <forge installer.jar>. Alternatively, type where java in CMD. Then double click on the installer in file explorer and use the java.exe path to execute it.

  2. After opening the installer, select "install server," and set the path to the aforementioned empty folder. Forge will install either a run.bat file or 2 jar files, depending on how new it is.

    • run.bat file- this is a windows batch file that will do all the work for you. Just double click it and a server should start running.

    • 2 jar server files- This is for older versions that installed a vanilla server alongside the forge server. Ignore the "minecraft_server" and focus on the one that says "forge." run the command java -jar <forge file.jar> to run it.

  3. Just like with the vanilla server, it won't work right away because you have to change the eula to be true. But this time, the server file will also populate the folder with a "mods" subdirectory. This is where you put all your mods into. You can download them from the curseforge website. I will be using the lucky block mod. Make sure to select your game version and the Forge mod loader.

  4. After downloading the mods (they are jar files), drag them into the mods folder. Then restart the server.

  5. The server should have mods now. Great! Unfortunately, each of the clients (people joining) also need the mods. The easiest way to do this is to use the CurseForge PC App. On there, you can create a new Minecraft "Profile." Its just a set of mods that you can tie into a single game instance. Make sure to select the right version, and add the same exact mods you added to the server, and launch it.

That's it! You can join using the loopback IP address I mentioned before or by using port forwarding and a public IP address. I personally reuse my website's domain name because it translates to my public IP anyways.

Please let me know if you have any questions! I would be glad to help.