sous-chefs / java

Development repository for the java cookbook
https://supermarket.chef.io/cookbooks/java
Apache License 2.0
386 stars 637 forks source link

JAVA_HOME environment variable missing in v8.x #598

Closed axelrtgs closed 3 years ago

axelrtgs commented 4 years ago

:speaking_head: Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

:ghost: Brief Description

JAVA_HOME environment variable missing in v8.x leading to applications not being able to find java

:pancakes: Cookbook version

v8.x

:woman_cook: Chef-Infra Version

v15 latest (ran in kitchen and it pulls latest)

:tophat: Platform details

CentOS7 and Ubuntu 16.04

Steps To Reproduce

openjdk_install '11'

:police_car: Expected behavior

java is installed and the application can find java

:heavy_plus_sign: Additional context

a workaround is to use the forgotten file and old set_java_home code from v7.0 to set JAVA_HOME and application can now find java

openjdk_install '11'

directory '/etc/profile.d' do
   mode '0755'
end

template '/etc/profile.d/jdk.sh' do
   cookbook 'java'
   source 'jdk.sh.erb'
   mode '0755'
end
damacus commented 4 years ago

Looks like a good work around though, /etc/profile.d doesn't work for every platform so we might need to look at a cross platform way of setting global variables.

Thanks for raising the issue!

damacus commented 4 years ago

I've fixed it (possibly) in AdoptOpenJDK if you want to fix it in other flavours please be my guest