Trying to run the [WSTP J/Link SampleProgram.java] Mathematica version 18.104.22.168 file from the MacOS Sierra version 10.12.6 Terminal, generates "Exception in thread "main" ...
Updating to Oracle JDK 8u144 solved problem.
Assuming you have Mathematica installed in the default location, as /Applications/Mathematica.app, there is no need to adjust the command as given in the tutorial (the first one in your question). If you have Mathematica installed in some different location or using some other name, you need to adjust the name leading up to the .app. If you're not 100% sure where you are, using the "pwd" command to find the location.
Your problem is that your setting for -classpath is wrong, namely you are missing the .app between "Mathematica" and "/". You can add the missing .app, or you can use the relative path suggest in the linked tutorial.