I tried installing Elastic Stack to a clean Windows 7 x64 and couldn't run it because it can't see Java. Both PATH and JAVA_HOME are set. The user is an admin. Same result with and without "Run as admin" command. Same result for JRE 8 and JDK 9. (Right now I only have 9 and pieces of 6 that came with Oracle.)
How to make Elastic programs see Java?
C:\Elastic\elasticsearch\bin>elasticsearch
could not find java; set JAVA_HOME or ensure java is in PATH
C:\Elastic\elasticsearch\bin>echo %path%
C:\ProgramData\Oracle\Java\javapath_target_9842531;C:\ProgramData\Oracle\Java\javapath_target_5202453;C:\app\admin\product\11.1.0\db_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\
C:\Elastic\elasticsearch\bin>echo %java_home%
C:\ProgramData\Oracle\Java
C:\Elastic\elasticsearch\bin>java -version
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
C:\Elastic\elasticsearch\bin>dir %java_home%
Volume in drive C has no label.
Volume Serial Number is 64EE-6DE2
Directory of C:\ProgramData\Oracle\Java
11/22/2017 08:51 PM <DIR> .
11/22/2017 08:51 PM <DIR> ..
11/22/2017 08:45 PM <DIR> .oracle_jre_usage
11/22/2017 08:51 PM <DIR> installcache_x64
11/22/2017 08:44 PM 14 java.settings.cfg
11/22/2017 08:51 PM <JUNCTION> javapath [C:\ProgramData\Oracle\Java\java
path_target_9842531]
11/22/2017 08:51 PM <DIR> javapath_target_9842531
1 File(s) 14 bytes
6 Dir(s) 13,177,876,480 bytes free
C:\Elastic\elasticsearch\bin>dir %java_home%\javapath
Volume in drive C has no label.
Volume Serial Number is 64EE-6DE2
Directory of C:\ProgramData\Oracle\Java\javapath
11/22/2017 08:51 PM <DIR> .
11/22/2017 08:51 PM <DIR> ..
11/22/2017 08:45 PM 231,488 java.exe
11/22/2017 08:45 PM 232,000 javaw.exe
11/22/2017 08:45 PM 333,888 javaws.exe
3 File(s) 797,376 bytes
2 Dir(s) 13,177,876,480 bytes free
Answer: Install JDK 8 and set
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_152