Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

java (139) Versions 1.24.0

Recipes and resources for installing Java and managing certificates

Policyfile
Berkshelf
Knife
cookbook 'java', '= 1.24.0', :supermarket
cookbook 'java', '= 1.24.0'
knife supermarket install java
knife supermarket download java
README
Dependencies
Quality -%

java

This cookbook installs a Java JDK/JRE. It defaults to installing
OpenJDK, but it can also install Oracle and IBM JDKs.

Usage

Simply include the java recipe wherever you would like Java installed, such as a run list (recipe[java]) or a cookbook (include_recipe 'java'). By default, OpenJDK 6 is installed. The install_flavor attribute is used to determine which JDK to install (OpenJDK, Oracle, IBM, or Windows), and jdk_version specifies which version to install (currently 6 and 7 are supported for all JDK types, 8 for Oracle only).

Examples

To install Oracle Java 7 (note that when installing Oracle JDK, accept_oracle_download_terms must be set -- see below for details):

name "java"
description "Install Oracle Java"
default_attributes(
  "java" => {
    "install_flavor" => "oracle",
    "jdk_version" => "7",
    "oracle" => {
      "accept_oracle_download_terms" => true
    }
  }
)
run_list(
  "recipe[java]"
)

To install IBM flavored Java:

name "java"
description "Install IBM Java on Ubuntu"
default_attributes(
  "java" => {
    "install_flavor" => "ibm",
    "ibm" => {
      "accept_ibm_download_terms" => true,
      "url" => "http://fileserver.example.com/ibm-java-x86_64-sdk-7.0-4.1.bin",
      "checksum" => "The SHA256 checksum of the bin"
    }
  }
)
run_list(
  "recipe[java]"
)

Requirements

Chef 0.10.10+ and Ohai 6.10+ for platform_family use.

Platform

  • Debian, Ubuntu
  • CentOS, Red Hat, Fedora, Scientific, Amazon, XenServer
  • ArchLinux
  • FreeBSD
  • SmartOS
  • Windows

Attributes

See attributes/default.rb for default values.

  • node['java']['install_flavor'] - Flavor of JVM you would like installed (oracle, openjdk, ibm, windows), default openjdk on Linux/Unix platforms, windows on Windows platforms.
  • node['java']['jdk_version'] - JDK version to install, defaults to '6'.
  • node['java']['java_home'] - Default location of the "$JAVA_HOME".
  • node['java']['openjdk_packages'] - Array of OpenJDK package names to install in the java::openjdk recipe. This is set based on the platform.
  • node['java']['tarball'] - Name of the tarball to retrieve from your internal repository, default jdk1.6.0_29_i386.tar.gz
  • node['java']['tarball_checksum'] - Checksum for the tarball, if you use a different tarball, you also need to create a new sha256 checksum
  • node['java']['jdk'] - Version and architecture specific attributes for setting the URL on Oracle's site for the JDK, and the checksum of the .tar.gz.
  • node['java']['oracle']['accept_oracle_download_terms'] - Indicates that you accept Oracle's EULA
  • node['java']['windows']['url'] - The internal location of your java install for windows
  • node['java']['windows']['package_name'] - The package name used by windows_package to check in the registry to determine if the install has already been run
  • node['java']['windows']['checksum'] - The checksum for the package to download on Windows machines (default is nil, which does not perform checksum validation)
  • node['java']['ibm']['url'] - The URL which to download the IBM JDK/SDK. See the ibm recipe section below.
  • node['java']['ibm']['accept_ibm_download_terms'] - Indicates that you accept IBM's EULA (for java::ibm)
  • node['java']['accept_license_agreement'] - Indicates that you accept the EULA for openjdk package installation.
  • node['java']['set_default'] - Indicates whether or not you want the JDK installed to be default on the system. Defaults to true.

Recipes

default

Include the default recipe in a run list or recipe to get java. By default
the openjdk flavor of Java is installed, but this can be changed by
using the install_flavor attribute. By default on Windows platform
systems, the install_flavor is windows.

OpenJDK is the default because of licensing changes made upstream by
Oracle. See notes on the oracle recipe below.

NOTE: In most cases, including just the default recipe will be sufficient.
It's possible to include the install_type recipes directly, as long as
the necessary attributes (such as java_home) are set.

set_attributes_from_version

Sets default attributes based on the JDK version. This is included by default.rb. This logic must be in
a recipe instead of attributes/default.rb. See #95
for details.

Updates /usr/lib/jvm/default-java to point to JAVA_HOME.

purge_packages

Purges deprecated Sun Java packages.

openjdk

This recipe installs the openjdk flavor of Java. It also uses the
alternatives system on RHEL/Debian families to set the default Java.

On platforms such as SmartOS that require the acceptance of a license
agreement during package installation, set
node['java']['accept_license_agreement'] to true in order to indicate
that you accept the license.

oracle

This recipe installs the oracle flavor of Java. This recipe does not
use distribution packages as Oracle changed the licensing terms with
JDK 1.6u27 and prohibited the practice for both RHEL and Debian family
platforms.

As of 26 March 2012 you can no longer directly download the JDK from
Oracle's website without using a special cookie. This cookbook uses
that cookie to download the oracle recipe on your behalf, however the
java::oracle recipe forces you to set either override the
node['java']['oracle']['accept_oracle_download_terms'] to true or
set up a private repository accessible by HTTP.

override the accept_oracle_download_terms in, e.g., roles/base.rb

default_attributes(
  :java => {
     :oracle => {
       "accept_oracle_download_terms" => true
     }
   }
)

For both RHEL and Debian families, this recipe pulls the binary
distribution from the Oracle website, and installs it in the default
JAVA_HOME for each distribution. For Debian, this is
/usr/lib/jvm/default-java. For RHEl, this is /usr/lib/jvm/java.

After putting the binaries in place, the java::oracle recipe updates
/usr/bin/java to point to the installed JDK using the
update-alternatives script. This is all handled in the java_ark
LWRP.

oracle_i386

This recipe installs the 32-bit Java virtual machine without setting
it as the default. This can be useful if you have applications on the
same machine that require different versions of the JVM.

This recipe operates in a similar manner to java::oracle.

oracle_rpm

This recipe installs the Oracle JRE or JDK provided by a custom YUM
repositories.
It also uses the alternatives system on RHEL families to set
the default Java.

windows

Because there is no easy way to pull the java msi off oracle's site,
this recipe requires you to host it internally on your own http repo.

IMPORTANT NOTE

If you use the windows recipe, you'll need to make sure you've uploaded
the aws and windows cookbooks. As of version 1.18.0, this cookbook
references them with suggests instead of depends, as they are only
used by the windows recipe.

ibm

The java::ibm recipe is used to install the IBM version of Java.
Note that IBM requires you to create an account and log in to
download the binary installer for your platform. You must accept the
license agreement with IBM to use their version of Java. In this
cookbook, you indicate this by setting
node['java']['ibm']['accept_ibm_download_terms'] to true. You must
also host the binary on your own HTTP server to have an automated
installation. The node['java']['ibm']['url'] attribute must be set
to a valid https/http URL; the URL is checked for validity in the recipe.

At this time the java::ibm recipe does not support multiple SDK
installations.

Resources/Providers

java_ark

This cookbook contains the java_ark LWRP. Generally speaking this
LWRP is deprecated in favor of ark from the
ark cookbook, but it is
still used in this cookbook for handling the Oracle JDK installation.

By default, the extracted directory is extracted to
app_root/extracted_dir_name and symlinked to app_root/default

Actions

  • :install: extracts the tarball and makes necessary symlinks
  • :remove: removes the tarball and run update-alternatives for all symlinked bin_cmds

Attribute Parameters

  • url: path to tarball, .tar.gz, .bin (oracle-specific), and .zip currently supported
  • checksum: SHA256 checksum, not used for security but avoid redownloading the archive on each chef-client run
  • app_home: the default for installations of this type of application, for example, /usr/lib/tomcat/default. If your application is not set to the default, it will be placed at the same level in the directory hierarchy but the directory name will be app_root/extracted_directory_name + "_alt"
  • app_home_mode: file mode for app_home, is an integer
  • bin_cmds: array of binary commands that should be symlinked to /usr/bin, examples are mvn, java, javac, etc. These cmds must be in the bin subdirectory of the extracted folder. Will be ignored if this java_ark is not the default
  • owner: owner of extracted directory, set to "root" by default
  • default: whether this the default installation of this package, boolean true or false

Examples

# install jdk6 from Oracle
java_ark "jdk" do
    url 'http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-x64.bin'
    checksum  'a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365'
    app_home '/usr/local/java/default'
    bin_cmds ["java", "javac"]
    action :install
end

java_alternatives

The java_alternatives LWRP uses update-alternatives command
to set and unset command alternatives for various Java tools
such as java, javac, etc.

Actions

  • :set: set alternatives for Java tools
  • :unset: unset alternatives for Java tools

Attribute Parameters

  • java_location: Java installation location.
  • bin_cmds: array of Java tool names to set or unset alternatives on.
  • default: whether to set the Java tools as system default. Boolean, defaults to true.
  • priority: priority of the alternatives. Integer, defaults to 1061.

Examples

# set alternatives for java and javac commands
java_alternatives "set java alternatives" do
    java_location '/usr/local/java`
    bin_cmds ["java", "javac"]
    action :set
end

Development

This cookbook uses
test-kitchen for
integration tests and
ChefSpec/RSpec for unit tests.
See TESTING.md for testing instructions.

At this time due to licensing concerns, the IBM recipe is not set up
in test kitchen. If you would like to test this locally, copy
.kitchen.yml to .kitchen.local.yml and add the following suite:

suites:
- name: ibm
  run_list: ["recipe[java]"]
  attributes:
    java:
      install_flavor: "ibm"
      ibm:
        accept_ibm_download_terms: true
        url: "http://jenkins/ibm-java-x86_64-sdk-7.0-4.1.bin"
        checksum: the-sha256-checksum

Log into the IBM DeveloperWorks site to download a copy of the IBM
Java SDK you wish to use/test, host it on an internal HTTP server, and
calculate the SHA256 checksum to use in the suite.

License and Author

Copyright: 2008-2013, Opscode, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

abiquo Applicable Versions
activemq Applicable Versions
aem Applicable Versions
aet Applicable Versions
akibanserver Applicable Versions
alfresco Applicable Versions
alfresco-utils Applicable Versions
alphard-artifactory Applicable Versions
alphard-chef-artifactory Applicable Versions
alphard-chef-deploy Applicable Versions
alphard-chef-sbt Applicable Versions
android-sdk Applicable Versions
ant Applicable Versions
apache-log-analysis Applicable Versions
apache-newrelic-plugin Applicable Versions
apache_hadoop Applicable Versions
apache_kafka Applicable Versions
apache_spark Applicable Versions
apache_spark_ng Applicable Versions
apache_tomcat Applicable Versions
apache_zookeeper Applicable Versions
apktool Applicable Versions
application_java Applicable Versions
archiva Applicable Versions
ark Applicable Versions
artifact-deployer Applicable Versions
artifactory Applicable Versions
artifactory_ii Applicable Versions
asgard Applicable Versions
askbot Applicable Versions
aws-cloud-watch-cli-tools Applicable Versions
aws_developer_tools Applicable Versions
bamboo Applicable Versions
bamboo-agent Applicable Versions
baragon Applicable Versions
bastion Applicable Versions
bazel Applicable Versions
bigdata Applicable Versions
bitbucket_server Applicable Versions
bjn_java Applicable Versions
bootstrap Applicable Versions
buildr Applicable Versions
cassandra Applicable Versions
cassandra-dse Applicable Versions
cassandra-opscenter Applicable Versions
cassandra-priam Applicable Versions
cassandra-reaper Applicable Versions
cdap Applicable Versions
cerner_kafka Applicable Versions
cerner_tomcat Applicable Versions
chamber-kibana Applicable Versions
chef Applicable Versions
chef-server Applicable Versions
chef-teamcity Applicable Versions
chef_crowd Applicable Versions
chef_ec2_cli_tools Applicable Versions
chef_jira Applicable Versions
chronos Applicable Versions
coffee-truck Applicable Versions
configure_and_deploy_ssc Applicable Versions
confluence Applicable Versions
confluent Applicable Versions
confluent-cookbook Applicable Versions
coopr Applicable Versions
corbel Applicable Versions
corus Applicable Versions
couchdb Applicable Versions
cq Applicable Versions
crowd Applicable Versions
deploy-play Applicable Versions
dima-repose Applicable Versions
drelephant Applicable Versions
drill Applicable Versions
dropwizard Applicable Versions
druid Applicable Versions
dse Applicable Versions
dse-chef Applicable Versions
dynatrace Applicable Versions
dynatrace-appmon Applicable Versions
elassandra Applicable Versions
elastic Applicable Versions
elasticsearch Applicable Versions
elasticsearch-cluster Applicable Versions
elasticsearch-ng Applicable Versions
elasticsearch_cluster Applicable Versions
elk Applicable Versions
elkstack Applicable Versions
emptyness Applicable Versions
enstratius_agent_proxy Applicable Versions
epipe Applicable Versions
esri-tomcat Applicable Versions
et_elk Applicable Versions
et_gradle Applicable Versions
et_mesos Applicable Versions
eulipion-cleanspeak Applicable Versions
exhibitor Applicable Versions
flink Applicable Versions
flume Applicable Versions
flyway-cli Applicable Versions
foreflight_build_agent Applicable Versions
formatron_monitor Applicable Versions
gads Applicable Versions
ganglia_cluster Applicable Versions
gatling Applicable Versions
gerrit Applicable Versions
glassfish Applicable Versions
gobblin Applicable Versions
gocd Applicable Versions
gocd_agent Applicable Versions
gradle Applicable Versions
graphhopper Applicable Versions
graylog2 Applicable Versions
grinder Applicable Versions
groovy Applicable Versions
hadoop Applicable Versions
hadoop_cluster Applicable Versions
hadoop_cluster_rpm Applicable Versions
hadoop_for_hbase Applicable Versions
hadoop_spark Applicable Versions
hbase Applicable Versions
hbase_cluster Applicable Versions
hipsnip-jetty Applicable Versions
hive Applicable Versions
hops Applicable Versions
ice Applicable Versions
idea Applicable Versions
ignite-openfire Applicable Versions
impala Applicable Versions
intel_hadoop_metrics Applicable Versions
jar_deployment Applicable Versions
java-management Applicable Versions
java-service Applicable Versions
java_sun Applicable Versions
javadeploy Applicable Versions
jboss Applicable Versions
jboss-atg Applicable Versions
jboss7 Applicable Versions
jenkins Applicable Versions
jenkins-server Applicable Versions
jenkins_config Applicable Versions
jenkins_jnlp_slave Applicable Versions
jenkins_utils Applicable Versions
jetty Applicable Versions
jira Applicable Versions
jmeter Applicable Versions
jmxsh-chef Applicable Versions
jpackage Applicable Versions
jruby Applicable Versions
kafka Applicable Versions
kafka-cluster Applicable Versions
kafka-manager Applicable Versions
kafka_broker Applicable Versions
karaf Applicable Versions
katello Applicable Versions
keycloak Applicable Versions
kibana5-gm Applicable Versions
kibana_lwrp Applicable Versions
kkafka Applicable Versions
knotx Applicable Versions
kzookeeper Applicable Versions
lein Applicable Versions
leiningen Applicable Versions
liquibase Applicable Versions
livy Applicable Versions
logstash Applicable Versions
logstash_simple Applicable Versions
looker Applicable Versions
mapr Applicable Versions
marathon Applicable Versions
maven Applicable Versions
mecab-java Applicable Versions
mesos Applicable Versions
midokura Applicable Versions
minecraft Applicable Versions
minecraft-server Applicable Versions
mule Applicable Versions
neo4j Applicable Versions
netkernel Applicable Versions
nexus Applicable Versions
nexus_repository_manager Applicable Versions
nodestack Applicable Versions
noosfero Applicable Versions
ohmage Applicable Versions
oozie Applicable Versions
opendj-openam Applicable Versions
openfire Applicable Versions
openhab Applicable Versions
openmq Applicable Versions
opennms Applicable Versions
openoffice Applicable Versions
opentsdb Applicable Versions
oracle-fmw Applicable Versions
oracle_java Applicable Versions
orientdb Applicable Versions
paramount Applicable Versions
pennyworth Applicable Versions
petals Applicable Versions
pig Applicable Versions
pipeline Applicable Versions
platformstack Applicable Versions
polyglot Applicable Versions
protractor Applicable Versions
puncha-kibana Applicable Versions
r_config Applicable Versions
recognizer Applicable Versions
resin Applicable Versions
riak Applicable Versions
riemann2 Applicable Versions
robot Applicable Versions
rubymine Applicable Versions
rundeck Applicable Versions
rundeck-alt Applicable Versions
rundeck-server Applicable Versions
sauceconnect Applicable Versions
sbt-extras Applicable Versions
scala Applicable Versions
sda-agent Applicable Versions
simple-cerebro Applicable Versions
singularity Applicable Versions
singularity_executor Applicable Versions
sips-office-server Applicable Versions
soa_tools Applicable Versions
solr Applicable Versions
solr-lts Applicable Versions
solr_6 Applicable Versions
solrcloud Applicable Versions
sonar Applicable Versions
sonarqube_server Applicable Versions
spark Applicable Versions
spigot Applicable Versions
spinen-artifactory Applicable Versions
spring-boot Applicable Versions
stack-java Applicable Versions
stack_commons Applicable Versions
stash Applicable Versions
storm Applicable Versions
storm-cluster Applicable Versions
subrosa Applicable Versions
sudo_elastic Applicable Versions
sudo_logstash Applicable Versions
sumologic-collector Applicable Versions
takipi Applicable Versions
taurus Applicable Versions
teamcity_server Applicable Versions
tekno-mineos Applicable Versions
tensorflow Applicable Versions
thrift Applicable Versions
titan Applicable Versions
tizen Applicable Versions
tomcat Applicable Versions
tomcat-all Applicable Versions
tomcat-openam Applicable Versions
tomcat-solr Applicable Versions
tomcat7 Applicable Versions
tomcat8 Applicable Versions
tomcat_latest Applicable Versions
tomee Applicable Versions
tungsten Applicable Versions
typesafe-stack Applicable Versions
unifi Applicable Versions
unjava Applicable Versions
vault-cli Applicable Versions
vertx Applicable Versions
was_liberty Applicable Versions
webgoat Applicable Versions
weblogic Applicable Versions
webobjects Applicable Versions
wildfly Applicable Versions
wlp Applicable Versions
xldeploy Applicable Versions
xlrelease Applicable Versions
yajsw Applicable Versions
youtrack Applicable Versions
zabbix Applicable Versions
zammad Applicable Versions
zendserver Applicable Versions
zenoss Applicable Versions
zeppelin Applicable Versions
ziggrid Applicable Versions
zipkin Applicable Versions
zncrypt Applicable Versions
zookeeper Applicable Versions
zookeeper-cluster Applicable Versions
zookeeper-grid Applicable Versions
zookeeper_cluster Applicable Versions
zookeeperd Applicable Versions

No quality metric results found