I have multiple versions of Java installed in the environment(I know it is bad). I've set the JAVA\_HOME to `jdk 1_4` directory. This is not installed, but extracted from zip and placed it somewhere. We have `java 1.8 JRE` also installed in the system. I never set the path to this installed directory. Now i'm trying to run some ant script that depends on jdk 1\_4. I get some exception saying that it is not able to find tools.jar in `java1.8...` .

My question is that when the path and java\_home are set to jdk 14 why does the ant look for 1.8 version of java? I'm confused. 

**Update**: I have looked up the duplicate issue. 

`Additional details:` Java -version prints 1.8 with jdk 14 in the path and java\_home. I uninstalled 1.8. reopened cmd tried java -version, now it errors out saying that it is not able to find java1.8 instead of trying to find the next java available in the path or java\_home. 

Error shown:

```
C:\Users\usrpao>java
Error: could not open `C:\Program Files\Java\jre8\lib\amd64\jvm.cfg'

```