Keep the error visible
If a command window opens and closes immediately, run the server from a terminal or a startup script that leaves the console visible. The error message is usually more useful than the fact that the window disappeared.
Check Java first
- Is Java installed?
- Is the server using the Java executable you expect?
- Is the Java version compatible with this Minecraft/server release?
- Are you using a 64-bit runtime for a normal modern server setup?
Check the server jar and working directory
An 'Unable to access jarfile' message usually means the jar path/name is wrong or the command is running from a different working directory. Verify the actual filename and folder instead of repeatedly reinstalling Java.
If it crashes after plugins or mods were added
Read the dependency/version error in the log, then test with the last change removed when safe. A plugin or mod built for another Minecraft version or loader can stop startup before the server ever reaches a ready state.
If the server starts but nobody can join
That is usually a different problem. A server that reaches its ready state but cannot be reached by players points toward address, firewall, port forwarding, ISP/NAT or client-version issues rather than startup itself.