How do I persuade Windows to use the JDK instead of a JRE?
This question has been asked before, here and elsewhere:
How do I set the default Java installatio
Windows doesn't ignore anything. This is an issue with your setup; Windows just uses what you provide. It has no special knowledge of JAVA_HOME
.
CLASSPATH
has nothing to do with Windows, either. To Windows it's only an environmental variable that gets expanded to a folder location.
Check your %PATH%
environmental variable. It's what's making Windows find one before the other. The path (as the post you linked to said) should point to %JAVA_HOME%\bin;<remainder of path>
. Again, the post you linked to gave you a way to set this using a batch file.
(For others who might not know this: The easiest way to inspect the %PATH% is to open a command prompt and type echo %PATH%
. You can also get there by right-clicking on Computer
in the right pane of the Start Menu and choosing Properties
, then Advanced System Settings
, and the tne Environmental Variables
button.)
Just in case if you are using .BAT file as Windows Service, I would suggest to uninstall the Windows service and reinstall it again after changing the %JAVA_HOME% to point to the right Java version..