When I last followed the instructions for creating a private cloud, the vcap_dev_setup script completed without errors. Today when I tried it I got an error:

Chef::Exceptions::Package: No version specified, 
and no candidate version available for sun-java6-bin

The package is required in dev_setup/cookbooks/java/recipes/default.rb:

bash "Setup java" do
  code <<-EOH
  add-apt-repository "deb http://archive.canonical.com/ lucid partner"
  apt-get -qqy update
  echo sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true | /usr/bin/debconf-set-selections
  echo sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true | /usr/bin/debconf-set-selections
  not_if do
%w[ curl sun-java6-bin sun-java6-jre sun-java6-jdk].each do |pkg|
  package pkg do
    not_if do

It seems that on 2012-02-17 this package was deleted from the lucid partner repository, so the above script no longer works. The explanation is that “Oracle (Sun) Java 6 is no longer available to be distributed by Ubuntu, because of license issues.”

Note that the above code will not attempt to install Java if it is already present, so the error can be avoided by installing Java before starting the vcap_dev_setup script. One approach, suggested at superuser.com, is to get the packages from another repository:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk

You will be required to accept the license. After it finishes, you can confirm that this does indeed install things:

dpkg --get-selections | grep java

Also you can see that the executable exists:

ll /usr/bin/java

There certainly are other ways to add Java to Ubuntu and I don’t suggest that this is the best way–only that it worked for me and now the vcap_dev_setup script completes successfully!