Switch to Oracle JDK

This commit is contained in:
Timotej Lazar 2022-10-04 09:02:57 +00:00
parent a7b3a7f02d
commit e80f7e55d1

View file

@ -1,29 +1,28 @@
- name: Set OpenJDK version
set_fact:
target_version: "18.0.2"
- name: Install OpenJDK
- name: Install Oracle JDK
win_chocolatey:
name: openjdk
version: "{{ target_version }}"
name: oraclejdk
- name: Find Java version
win_reg_stat:
path: HKLM:\SOFTWARE\JavaSoft\JDK
name: CurrentVersion
register: reg
- name: Find Java home
win_reg_stat:
path: "HKLM:\\SOFTWARE\\JavaSoft\\JDK\\{{ reg['value'] }}"
name: JavaHome
register: reg
- name: Set JAVA_HOME
win_environment:
name: JAVA_HOME
value: "C:\\Program Files\\OpenJDK\\jdk-{{ target_version }}"
value: "{{ reg['raw_value'] }}"
level: machine
# XAMPP insists on looking for Java and failing without this.
- name: Set registry key for OpenJDK
- name: Disable Java updates
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"
path: HKLM:\SOFTWARE\WOW6432Node\JavaSoft\Java Update\Policy
name: EnableJavaUpdate
type: dword
data: 0