I am using Windows 10, and I have JDK 1.7, JRE 1.8 and OpenJDK 17 installed.
After running a batch file to switch Java versions, I am unable to launch Eclipse using the taskbar search.
However, it works fine when I launch it from File Explorer.
I would like to be able to launch Eclipse from the taskbar search as well.
Here is the content of the batch files I wrote.
@echo off
setx JAVA_HOME "C:\Program Files\Java\jdk1.7.0_80" -m
echo Java 7 activated.
java -version
timeout /t 10
@echo off
setx JAVA_HOME "C:\Program Files\Microsoft\jdk-17.0.3.7-hotspot" -m
echo Java 17 activated.
java -version
timeout /t 10
When I run this file, the "java -version" part always outputs "java version 1.8.0_401."
However, if I run "java -version" separately in cmd or PowerShell, it displays the changed Java version.
Upon direct verification, the environment variables are also properly reflected.
When running Eclipse with Java version 17 through File Explorer, it launches successfully.
However, when attempting to run it through taskbar search, I always encounter the following message.
Version 1.8.0_401 of the JVM is not suitable for this product. Version: 17 or greater is required.
Why doesn't Eclipse run when launched from the taskbar search, and how can I resolve this issue?