Ionic build and run doesnt use right java version

I have 2 versions of java installed. i have jdk 12 and JDK SE 1.8 .

javac -version                                                                        
 javac 12.0.2   
java -version                                                                         
java version "1.8.0_221"                                                                                                
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)                                                                   
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)    `

sadly when building using cordova, its trying to use javac -version, which is the wrong version.
when this version is uninstalled it uses the correct version, but i need this java version for other project.

i want to use the 1.8.* version and not the 12.0.2 version, but oddly enough it doesnt allow it.

it’s a dumb fix, but you should simply switch the order of your PATH in Environment Variables.

Hopes it helps some people in the future.

1 Like