javawindowsjarcommandminecraft

Attempting to run a Minecraft server and I keep getting Error: unable to access jarfile


I'm trying to run a minecraft server and when I type the command:

java -Xmx1024M -xms1024M -jar minecraft_server.1.21.jar

and I get - Error: unable to access jarfile minecraft_server.1.21.jar...

I looked at a few post talking about permissions so I tried running cmd as administrator and even navigated to the file path to run it.

Edit: enter image description here

This shows the file path of the server and path of the command I ran. what am I missing?

Also not sure if its helpful but I'm running a windows VM via proxmox.


Solution

  • The java command you are running is looking for a file named minecraft_server.1.12.jar. When you look at your file explorer the only files possible for it to even find are run.bat and server.jar (Based on the original screenshot). So you have to have these match. Either by renaming the jar file or changing the command.

    Ps: Highly recommend turning on file extensions.

    Another thing I'n noticing is the use of pause in the same command as the java command. This pause command won't ever run. In your run.bat it should look something like this.

    java -Xmx1024M -Xms1024M -jar jarfile.jar nogui
    pause