I've been hosting a Minecraft Java Version server for some friends for a few days now. It's running on an old Windows laptop with 8GB RAM and a 2.4GHz processor; not the beefiest machine, but it gets the job done. The server has been running fine, but I wanted to launch it through a .bat file to add some JVM arguments to improve performance, since pretty much everyone recommends to do this (originally, I was just running the server by launching the minecraft_server.jar file).
I wrote a simple .bat file to launch the server, based on this tutorial:
@ECHO OFF
java -Xms1024M -Xmx2048M -jar minecraft_server.jar --nogui
pause
The .bat file is in the same directory as the minecraft_server.jar file, and it launches the server successfully. However, other computers are not able to connect to the server, not even other computers on my local network. The only computer that is able to connect to the server is the localhost. (I also verified that it is the same actual server; the system is not somehow creating an entirely separate world or something.)
Port forwarding shouldn't be an issue, since I opened the ports on my router as well as on Windows Firewall when I was originally setting up the server. I also assigned a static IP for the computer running the server (which is connected to my router via Ethernet, not Wi-Fi). The server runs on the same port as the one I'm port forwarding when I launch it through the .bat file, as well as when I launch it through minecraft_server.jar.
I've tried setting the server-ip in the server.properties file a number of different ways - setting it to my IP address, to the static IP I assigned in my router settings, and leaving it blank. I wasn't able to connect under any of these conditions (setting it to my IP address also caused the server not to launch, saying that something else was running on the port).
Is there some reason why running the server through a .bat file rather than by directly launching the minecraft_server.jar file would somehow change the network configuration of the server? Or is there some other setting or command somewhere that I need to account for?
I had an issue like this a while ago. What I did was fully disable Windows Firewall and it worked after. Also, make sure you don't have any other firewall/antivirus programs running as they mess with port forwarding
When you double click the jar, Windows launches the server with javaw.exe. When you use a batch file, it uses java.exe. Likely your firewall has an exception for javaw but not java.
I've tried setting the server-ip in the server.properties file a number of different ways - setting it to my IP address, to the static IP I assigned in my router settings, and leaving it blank. I wasn't able to connect under any of these conditions (setting it to my IP address also caused the server not to launch, saying that something else was running on the port).
It wasn't saying you had something on the port, it was saying the IP is not valid. Don't put anything in server-ip, especially not an IP that isn't available on a local interface. That field is meant to control binding, and unless you have a multihomed system in which you want to restrict binding, that field is best left empty.
When you double click the jar, Windows launches the server with javaw.exe. When you use a batch file, it uses java.exe. Likely your firewall has an exception for javaw but not java.
This was the issue. I created a firewall exception for java.exe and I'm able to connect fine. Thank you!
I've been hosting a Minecraft Java Version server for some friends for a few days now. It's running on an old Windows laptop with 8GB RAM and a 2.4GHz processor; not the beefiest machine, but it gets the job done. The server has been running fine, but I wanted to launch it through a .bat file to add some JVM arguments to improve performance, since pretty much everyone recommends to do this (originally, I was just running the server by launching the minecraft_server.jar file).
I wrote a simple .bat file to launch the server, based on this tutorial:
https://minecraft.fandom.com/wiki/Tutorials/Setting_up_a_server
The .bat file is in the same directory as the minecraft_server.jar file, and it launches the server successfully. However, other computers are not able to connect to the server, not even other computers on my local network. The only computer that is able to connect to the server is the localhost. (I also verified that it is the same actual server; the system is not somehow creating an entirely separate world or something.)
Port forwarding shouldn't be an issue, since I opened the ports on my router as well as on Windows Firewall when I was originally setting up the server. I also assigned a static IP for the computer running the server (which is connected to my router via Ethernet, not Wi-Fi). The server runs on the same port as the one I'm port forwarding when I launch it through the .bat file, as well as when I launch it through minecraft_server.jar.
I've tried setting the server-ip in the server.properties file a number of different ways - setting it to my IP address, to the static IP I assigned in my router settings, and leaving it blank. I wasn't able to connect under any of these conditions (setting it to my IP address also caused the server not to launch, saying that something else was running on the port).
Is there some reason why running the server through a .bat file rather than by directly launching the minecraft_server.jar file would somehow change the network configuration of the server? Or is there some other setting or command somewhere that I need to account for?
I had an issue like this a while ago. What I did was fully disable Windows Firewall and it worked after. Also, make sure you don't have any other firewall/antivirus programs running as they mess with port forwarding
When you double click the jar, Windows launches the server with javaw.exe. When you use a batch file, it uses java.exe. Likely your firewall has an exception for javaw but not java.
It wasn't saying you had something on the port, it was saying the IP is not valid. Don't put anything in server-ip, especially not an IP that isn't available on a local interface. That field is meant to control binding, and unless you have a multihomed system in which you want to restrict binding, that field is best left empty.
This was the issue. I created a firewall exception for java.exe and I'm able to connect fine. Thank you!