NOTE: This cookbook is up for adoption. We moved on from using the Oracle JDK after they began requiring sign-in for downloading LTS versions and I am no longer maintaining it.
Installs and configures Oracle's Java SE JDK 11.
See Critical Patch Updates for next scheduled JDK release.
Important Notice: The patch version of the cookbook is now 1000 times the patch level of the Java version
it's installing plus an incrementing number controlled by the cookbook author(s). For example, if the cookbook
version is 11.0.2000
, then that's the first release of the cookbook for Java 11.0.2. If the cookbook version
is 11.0.2004
, then that's the fifth release of the cookbook for Java 11.0.2. [#31]
- Chef 12+
- CentOS, Red Hat, Fedora
- Debian, Ubuntu
- Amazon Linux
- Mac OS X
- Windows
By adding java_se to a run list or cookbook you are accepting the Oracle Binary Code License Agreement for Java SE.
Older versions of Java JDK are no longer publicly available after a patch update. So it is recommended that you download JDK from alternative location, or constrain java_se cookbook version. Note that the latter solution could result in a failed converge when a new patch update is released and a matching version of java_se cookbook is not yet available. A release of java_se cookbook usually follows within a day after a patch update.
Windows JAVA_HOME and PATH environment variables are not available
during initial chef-client run. Attribute
node['java_se']['win_javalink']
provides a symbolic link to installed
Java JDK bin directory and is available during initial chef-client run.
This will download the JDK that best matches platform criteria. Note that JDK file names must be the same as that found on Oracle's download page.
A script to download JDKs from Oracle and upload them to Amazon S3 is available here.
override_attributes(
"java_se": {
"uri": "https://s3.amazonaws.com/mybucket/java"
}
)
Constrain version in cookbook to latest Java SE JDK 11.
depends 'java_se', '~> 11.0'
Constrain version in environment to latest Java SE JDK 11.
cookbook 'java_se', '~> 11.0'
node['java_se']['uri']
- The URI to the Java SE JDKs. If a directory is provided, it will then automatically assign a file name that best matches platform criteria. The JDK file names must be the same as that found on Oracle's download page. Leave nil to download directly from Oracle. Defaultnil
.node['java_se']['skip']
- Skips installing Java SE. Defaultfalse
.node['java_se']['java_home']
- Alternative java_home location. Leave nil to use default location. For Linux and Windows only. Defaultnil
.
node['java_se']['set_default']
- Indicates whether or not you want the JDK installed to be default on the system. Defaulttrue
.node['java_se']['owner']
- The owner of extracted directory. Defaultroot
.node['java_se']['group']
- The group of extracted directory. Defaultroot
.node['java_se']['alternatives_priority']
- A priority of the alternatives. Default1061
.node['java_se']['set_etc_environment']
- Optionally sets JAVA_HOME in /etc/environment for. Defaultfalse
.node['java_se']['reset_alternatives']
- Whether alternatives is reset. Defaulttrue
.node['java_se']['use_alt_suffix']
whether '_alt' suffix is used for none default java install. Defaultfalse
.node['java_se']['bin_cmds']
- Array of binary commands to symlink /usr/bin to, and set alternative on. Examples are mvn, java, javac, etc. These cmds must be in the bin subdirectory of the extracted folder. Will be ignored if set_default is not true.
node['java_se']['win_addlocal']
- JDK features to install. DefaultToolsFeature,SourceFeature
.node['java_se']['win_javalink']
- Symbolic link to Java JDK bin directory. Since Windows PATH and JAVA_HOME are not available during chef-client run, this provides a way for cookbooks to access the latest installed version. Default%SYSTEMDRIVE%\java\bin
.
node['java_se']['release']
- The JDK release version.node['java_se']['build']
- The build number.node['java_se']['sha256'][type]
- The checksum to validate the installer with. Wheretype
is one of 'dmg', 'exe', or 'tar'.
- Ask specific questions on Stack Overflow.
- Report bugs and discuss potential features in Github issues.
Please refer to CONTRIBUTING.
MIT - see the accompanying LICENSE file for details.