Key tool is not recognized

I followed the NSB video tutorial on how to generate a key.
All went well to this point . . .

Microsoft Windows [Version 10.0.18362.778]
© 2019 Microsoft Corporation. All rights reserved.

C:\Users\David> cd C:\Program Files (x86)\Java\jre1.8.0_251

C:\Program Files (x86)\Java\jre1.8.0_251>keytool -genkey -v -keystore PedCalc.keystore -alias PedCalc -keyalg RSA -keysize 2048 -validity 10000
‘keytool’ is not recognized as an internal or external command,
operable program or batch file.

There seems to be some disagreement on fixes I am finding. They have to do with the way JAVA_HOME is set up in Environmental Settings. Some say it needs to be ‘…\bin’
Some say both jre and jdk need to be there.
What is the definitive solution?

Rather than messing with links, you can try entering the full path. Something like this:

"C:\Program Files\Java\jdk1.8.0_241\bin\keytool.exe" ...

The “jdk1.8.0_241” will change based on the version of Java you have installed.

Found the problem. I was using a Sample Program of Java jdk. I downloaded the real one then I got most of the way through the keystore setup and on my final ‘Enter’ I got this error message: (I was soooo close)

    (RETURN if same as keystore password):

[Storing PedCalc.keystore]
keytool error: java.io.FileNotFoundException: PedCalc.keystore (Access is denied)
java.io.FileNotFoundException: PedCalc.keystore (Access is denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:101)
at sun.security.tools.keytool.Main.doCommands(Main.java:1196)
at sun.security.tools.keytool.Main.run(Main.java:368)
at sun.security.tools.keytool.Main.main(Main.java:361)

C:\Program Files (x86)\Java\jdk1.8.0_251\bin>

…needed to run as administrator. Problem solved.