Skip to content

Commit

Permalink
Set correct path to java executable for java 11+
Browse files Browse the repository at this point in the history
  • Loading branch information
p-j-smith committed Mar 24, 2024
1 parent 0b1f8de commit f2bc548
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions roles/install_java/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,21 @@
path: "/usr/lib/jvm/{{ java_package }}"
register: java_package_info

- name: Check if JRE exists
ansible.builtin.stat:
path: "{{ java_package_info.stat.lnk_source }}/jre"
register: java_jre

- name: Set the default java version - {{ java_package_info.stat.lnk_source }}
community.general.alternatives:
name: java
path: "{{ java_package_info.stat.lnk_source }}/jre/bin/java"
state: selected
when: java_jre.stat.exists

- name: Set the default java version - {{ java_package_info.stat.lnk_source }}
community.general.alternatives:
name: java
path: "{{ java_package_info.stat.lnk_source }}/bin/java"
state: selected
when: not java_jre.stat.exists

0 comments on commit f2bc548

Please sign in to comment.