- name: Set OpenJDK version set_fact: target_version: "18.0.2" - name: Install OpenJDK win_chocolatey: name: openjdk version: "{{ target_version }}" - name: Set JAVA_HOME win_environment: name: JAVA_HOME value: "C:\\Program Files\\OpenJDK\\jdk-{{ target_version }}" level: machine # XAMPP insists on looking for Java and failing without this. - name: Set registry key for OpenJDK win_regedit: path: HKLM:\SOFTWARE\JavaSoft\Java Development Kit - name: Create .jar file type win_regedit: path: "HKCR:\\.jar" data: "jarfile" - name: Create association for jarfile win_regedit: path: "HKCR:\\jarfile\\shell\\open\\command" data: C:\Program Files\OpenJDK\jdk-{{ target_version }}\bin\javaw.exe -jar "%1"