Hi all,

I've been playing around with homebrew to create a formula for karaf similar to 
the one which is provided by tomcat. A description on how to conduct the basic 
steps can be found in a blog post: 
http://christoph-emmersberger.blogspot.de/2013/01/homebrew-formula-for-apache-karaf.html

However, when I create an additional symlink to the '/usr/bin/' directory for 
the 'karaf' command, I run into an issue since the command is not being 
executed within KARAF_HOME.

Formula:
require 'formula'

class ApacheKaraf < Formula
  homepage 'http://karaf.apache.org/'
  url 'http://www.eu.apache.org/dist/karaf/2.3.0/apache-karaf-2.3.0.tar.gz'
  version '2.3'
  sha1 'c243d39ba90543f6b0a058a183733756a797b4e5'

  def install
    libexec.install Dir['*']
    bin.install_symlink "#{libexec}/bin/karaf" => "karaf"
  end

end

Execution:
> karaf
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/karaf/main/Main
Caused by: java.lang.ClassNotFoundException: org.apache.karaf.main.Main
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Is there a convenient way to call a setenv command that redirects you to the 
karaf folder to get this working, maybe similar to the tomcat implementation?

Kind regards,

Christoph


Reply via email to