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 - name: Install Oracle JDK
set_fact:
target_version: "18.0.2"
- name: Install OpenJDK
win_chocolatey: win_chocolatey:
name: openjdk name: oraclejdk
version: "{{ target_version }}"
- 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 - name: Set JAVA_HOME
win_environment: win_environment:
name: JAVA_HOME name: JAVA_HOME
value: "C:\\Program Files\\OpenJDK\\jdk-{{ target_version }}" value: "{{ reg['raw_value'] }}"
level: machine level: machine
# XAMPP insists on looking for Java and failing without this. - name: Disable Java updates
- name: Set registry key for OpenJDK
win_regedit: win_regedit:
path: HKLM:\SOFTWARE\JavaSoft\Java Development Kit path: HKLM:\SOFTWARE\WOW6432Node\JavaSoft\Java Update\Policy
name: EnableJavaUpdate
- name: Create .jar file type type: dword
win_regedit: data: 0
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"