Java cookbook error on OSX

Hi

I am getting this error while trying to run the Java cookbook on OSX (
https://supermarket.getchef.com/cookbooks/java ) -

Compiling Cookbooks…

Converging 4 resources

Recipe: java::openjdk

  • package[openjdk-6-jdk] action install

================================================================================

Error executing action `install` on resource 'package[openjdk-6-jdk]'

================================================================================

Errno::ENOENT

-------------

No such file or directory - port



Resource Declaration:

---------------------

# In /var/chef/cache/cookbooks/java/recipes/openjdk.rb



 46:   package pkg do

 47:     version node['java']['openjdk_version'] if

node[‘java’][‘openjdk_version’]

 48:   end

 49: end



Compiled Resource:

------------------

# Declared in /var/chef/cache/cookbooks/java/recipes/openjdk.rb:46:in

`block in from_file’

package("openjdk-6-jdk") do

  action :install

  retries 0

  retry_delay 2

  guard_interpreter :default

  package_name "openjdk-6-jdk"

  timeout 900

  cookbook_name "java"

  recipe_name "openjdk"

end

Please help.

Thanks,

Mukta.

Hi,

On 10 November 2014 12:06, Mukta A amukta@gmail.com wrote:

[...]

Errno::ENOENT

-------------

No such file or directory - port

I believe that the package resource is trying to find MacPorts to
install the package and failing at it.
But, the underlying problem might be lack of support for OS X by the
coobkook, as per https://github.com/agileorbit-cookbooks/java

Have a look at GitHub - sous-chefs/homebrew: Development repository for the homebrew cookbook,
especially the additional Homebrew Casks.

Hope this helps.

Regards,
Krzysztof

Hello,

As Krzysztof said, the default package provider on OS X when using Chef 11
or earlier is Macports, so the package resource is attempting to determine
the state of the "openjdk-6-jdk" package using the "port" command. Since
you don't have Macports installed, that fails.

However, it's worth noting that the java cookbook does not support OS X for
Java installation at this time. Since Apple makes Java installation
available through their own means0, I don't know that it would be in
scope to attempt to support it using the "package" resource.

Also note that in Chef 12, homebrew will be the default package provider
for OS X[1].

[1]: http://docs.getchef.com/release/12-0/release_notes.html#what-s-new -
"homebrew_package"

On Mon, Nov 10, 2014 at 5:06 AM, Mukta A amukta@gmail.com wrote:

Hi

I am getting this error while trying to run the Java cookbook on OSX (
https://supermarket.getchef.com/cookbooks/java ) -

Compiling Cookbooks...

Converging 4 resources

Recipe: java::openjdk

  • package[openjdk-6-jdk] action install

================================================================================

Error executing action `install` on resource 'package[openjdk-6-jdk]'

================================================================================

Errno::ENOENT

-------------

No such file or directory - port



Resource Declaration:

---------------------

# In /var/chef/cache/cookbooks/java/recipes/openjdk.rb



 46:   package pkg do

 47:     version node['java']['openjdk_version'] if

node['java']['openjdk_version']

 48:   end

 49: end



Compiled Resource:

------------------

# Declared in /var/chef/cache/cookbooks/java/recipes/openjdk.rb:46:in

`block in from_file'

package("openjdk-6-jdk") do

  action :install

  retries 0

  retry_delay 2

  guard_interpreter :default

  package_name "openjdk-6-jdk"

  timeout 900

  cookbook_name "java"

  recipe_name "openjdk"

end

Please help.

Thanks,

Mukta.

--
Joshua Timberman, Chef.

On Mon, Nov 10, 2014 at 1:05 PM, Joshua Timberman joshua@getchef.com wrote:

However, it's worth noting that the java cookbook does not support OS X for
Java installation at this time. Since Apple makes Java installation
available through their own means[0], I don't know that it would be in scope
to attempt to support it using the "package" resource.

That's correct, the Java cookbook does not support OS X as a platform
because the installation mechanism is so different.

I've attempted to automate Mac Java installs in Chef before, so this
code might be of interest to you. I can't guarantee that it still
works as it's about a year old and Apple changes things all the time.

  • Julian

--
[ Julian C. Dunn jdunn@aquezada.com * Sorry, I'm ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]

Thanks.
I will try out the cookbook suggested by Julian. I am trying to install
IntelliJ using Chef so would have to make some more changes.

On 11 November 2014 05:18, Julian C. Dunn jdunn@aquezada.com wrote:

On Mon, Nov 10, 2014 at 1:05 PM, Joshua Timberman joshua@getchef.com
wrote:

However, it's worth noting that the java cookbook does not support OS X
for
Java installation at this time. Since Apple makes Java installation
available through their own means[0], I don't know that it would be in
scope
to attempt to support it using the "package" resource.

That's correct, the Java cookbook does not support OS X as a platform
because the installation mechanism is so different.

I've attempted to automate Mac Java installs in Chef before, so this
code might be of interest to you. I can't guarantee that it still
works as it's about a year old and Apple changes things all the time.

https://github.com/chef-osx/macapps/blob/master/recipes/java.rb

  • Julian

--
[ Julian C. Dunn jdunn@aquezada.com * Sorry, I'm ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]

I haven’t tested this, but you could also try the Homebrew Cask: https://github.com/caskroom/homebrew-cask/blob/master/Casks/intellij-idea-ce.rb https://github.com/caskroom/homebrew-cask/blob/master/Casks/intellij-idea-ce.rb

-T

On Nov 10, 2014, at 7:40 PM, Mukta A amukta@gmail.com wrote:

Thanks.
I will try out the cookbook suggested by Julian. I am trying to install IntelliJ using Chef so would have to make some more changes.

On 11 November 2014 05:18, Julian C. Dunn <jdunn@aquezada.com mailto:jdunn@aquezada.com> wrote:
On Mon, Nov 10, 2014 at 1:05 PM, Joshua Timberman <joshua@getchef.com mailto:joshua@getchef.com> wrote:

However, it's worth noting that the java cookbook does not support OS X for
Java installation at this time. Since Apple makes Java installation
available through their own means[0], I don't know that it would be in scope
to attempt to support it using the "package" resource.

That's correct, the Java cookbook does not support OS X as a platform
because the installation mechanism is so different.

I've attempted to automate Mac Java installs in Chef before, so this
code might be of interest to you. I can't guarantee that it still
works as it's about a year old and Apple changes things all the time.

https://github.com/chef-osx/macapps/blob/master/recipes/java.rb https://github.com/chef-osx/macapps/blob/master/recipes/java.rb

  • Julian

--
[ Julian C. Dunn <jdunn@aquezada.com mailto:jdunn@aquezada.com> * Sorry, I'm ]
[ WWW: http://www.aquezada.com/staff/julian http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ http://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]