The command will only work if you are in the same directory as the jar file is located. After opening the command prompt you must change it to the location of the file first. This can be done using the command
I have a backup of my network saved in my documents folder so as an example I would run:
and then run the java command.
As Tails has pointed out, it is always best practice to have a .bat file as in the event of a server crash you can automatically start the server back up by adding the script to your server configuration. It is also just easier in general.