Whenever you interact with a computer system, you - the user - perform these interactions through an environment known as a shell. The shell can be a command line shell or a graphical shell, but in either case, it provides you a way to launch and manage your processes.
This environment contains a special variable known as PATH. The PATH variable is simply a list of filepaths to the various directories on your system that contain executable files (such as scripts or binary files).
An important piece of information is that every user process on your system (such as instances of Appium) has their own copy of this PATH variable. Whenever such a process wants to spawn a child process to run another program, the parent process needs the name of the executable file for the child process's program to be available in one of the directories listed in the PATH environment variable (or the parent needs to use an absolute path, but that's an unimportant side note for this particular case).
If java can not be found through one of the directories listed in the PATH variable, then Appium will fail when it tries to run Java. Since you're using Windows, you should follow a guide to finding where you can set your PATH variable. Feel free to use your favorite web search engine to find additional articles, guides, or tutorials on setting this value.