Had the same problem. Running macOS Catalina 10.15.6. Installed Java 8 from Oracle's website, as suggested in this post. However, it's true that even after installing java 8, the "java" command still links to the built-in installed java.
This can be checked by typing
java -version
Which outputs : java version "14.0.2" 2020-07-14
You can also see where the binary is by typing
whereis java
Result: /usr/bin/java
After a bit of searching, the Java 8 binary, on the Mac, when installed from Oracle, is at:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
This is the correct binary, as shown by checking the version:
"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/./java" -version
Result: java version "1.8.0_261"
Here is my working startup script:
#!/bin/bash
cd "$(dirname "$0")"
"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/./java" -Xms4G -Xmx4G -jar forge-1.12.2-14.23.5.2854.jar
Note that you need to either quote the path or escape the space.
Hope it helps