How to Set Up a Java Minecraft Server on Windows and Enable Public Access with cpolar
This step‑by‑step guide shows how to install Java, configure a Minecraft Java Edition server on Windows, create a startup batch file, adjust server properties, test LAN connectivity, and use cpolar to create a public TCP tunnel (including a fixed address) for remote gameplay without needing a public IP.
Preface
This tutorial explains how to build a Java‑edition Minecraft server on a Windows machine and use cpolar tunneling to bypass LAN restrictions, allowing friends to connect over the public internet without a public IP or router configuration.
1. Set Up the Minecraft Server
1.1 Install the Java Environment
Download Java 17 from Oracle, run the installer with default options, and note the JDK installation path (e.g., C:\Program Files\Java\jdk-17.0.5 ).
Open Advanced System Settings → Environment Variables , create a new system variable JAVA_HOME with the JDK path, and add %JAVA_HOME%\bin to the Path variable. Verify the installation by opening a command prompt and running javac .
1.2 Configure the Server
Download the latest Minecraft server JAR from the official site. In the same folder, create a new text file, rename it to start.bat , and add the following lines:
java -Xms1G -Xmx2G -jar server.jar nogui
pauseRun the batch file; it will generate several files, including eula.txt . Open eula.txt and change eula=false to eula=true . Then edit server.properties to set online-mode=false (disable authentication) and adjust any other settings as desired.
Double‑click start.bat again to launch the server.
2. Test LAN Connectivity
Open the Minecraft launcher, go to Multiplayer , click Add Server , enter a name and the local IP address with port 25565 (e.g., 127.0.0.1:25565 ), and join to verify the server works on the LAN.
3. Public Remote Connectivity
3.1 Install cpolar
Download the Windows ZIP package from the cpolar website, extract it, and run the installer with default settings. (Linux users can follow the provided script link.)
3.2 Create a Tunnel Mapping the Internal Port
After installation, open a browser to http://127.0.0.1:9200/ and log in to the cpolar web UI. Create a new tunnel with the following settings:
Protocol: TCP
Local address: 25565 (Minecraft default)
Port type: Random temporary TCP port
Region: China VIP
Click Create . The tunnel will become active and a public address such as 3.tcp.vip.cpolar.cn:10786 will be displayed.
3.3 Test Public Remote Connection
In Minecraft, add a new server using the public address 3.tcp.vip.cpolar.cn:10786 and join. The connection should succeed, demonstrating remote play over the internet.
4. Configure a Fixed TCP Address
Random temporary addresses change every 24 hours. To obtain a stable address, upgrade cpolar to a professional plan, reserve a fixed TCP address (e.g., 5.tcp.vip.cpolar.cn:12637 ), and edit the existing tunnel to use the reserved address instead of a random one.
After updating, the tunnel will show the fixed address, and players can connect using it without the address changing.
Conclusion
By following these steps you can run a Minecraft Java server on Windows, expose it to the public internet with cpolar, and optionally secure a permanent TCP endpoint for reliable remote gameplay.
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.