Trying to run the [WSTP J/Link SampleProgram.java] Mathematica version 126.96.36.199 file from the MacOS Sierra version 10.12.6 Terminal, generates "Exception in thread "main" ...
Updating to Oracle JDK 8u144 solved problem.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.Sign up to join this community
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.