I'm quite certain that you are using a more recent version of java that is not supported by older forge. For 1.12.2 forge, I use oracle's java version "1.8.0_333" (java 8).
https://www.oracle.com/java/technologies/downloads/#java8-windows
The installation process is not very easy, so I would recommend following a tutorial (for example).
Best of luck.