More info. Its the PATH variable that determines which java environment is invoked. On windows type "echo %PATH%" to view your PATH. The first java environment in your path will be invoked. The CLASSPATH environment variable will be used for loading classes required by the java program unless it is overridden. PATH, CLASSPATH, and CurrentVersion in the registry should be consistent.