0

vlcj プロジェクトの JRuby ラッパーの構築に取り組んでいます。今のところ、JBundler を使用して依存関係を管理しています。

Jbundler は、次のような .jbundler/classpath.rb を提供します。

JBUNDLER_CLASSPATH = []
JBUNDLER_CLASSPATH << '/Users/myth/.m2/repository/uk/co/caprica/vlcj/2.4.1/vlcj-2.4.1.jar'
JBUNDLER_CLASSPATH << '/Users/myth/.m2/repository/net/java/dev/jna/jna/3.5.2/jna-3.5.2.jar'
JBUNDLER_CLASSPATH << '/Users/myth/.m2/repository/net/java/dev/jna/platform/3.5.2/platform-3.5.2.jar'
JBUNDLER_CLASSPATH.freeze
JBUNDLER_CLASSPATH.each { |c| require c }

vlcj をインポートしようとしているコードは次のとおりです。

require 'java'
require '.jbundler/classpath' 

java_import 'com.sun.jna.NativeLibrary'
java_import 'uk.co.caprica.vlcj.runtime.RuntimeUtil'
java_import 'uk.co.caprica.vlcj.binding.LibVlc'

class Player

end

私はrspecを使用してコードを駆動していますが、実行するたびに常に次のようになります:

/Users/myth/.rvm/rubies/jruby-1.7.4/bin/jruby -S rspec spec/bollywood_spec/player_spec.rb
NameError: cannot link Java class uk.co.caprica.vlcj.binding.LibVlc, probable missing dependency: Unable to load library 'vlc': JNA native support (darwin/libvlc.dylib) not found in resource path ()
          for_name at org/jruby/javasupport/JavaClass.java:1242
   get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
       java_import at file:/Users/myth/.rvm/rubies/jruby-1.7.4/lib/jruby.jar!/jruby/java/core_ext/object.rb:26
               map at org/jruby/RubyArray.java:2417
       java_import at file:/Users/myth/.rvm/rubies/jruby-1.7.4/lib/jruby.jar!/jruby/java/core_ext/object.rb:22
            (root) at /Users/myth/Learn/Code/Projects/bollywood/lib/bollywood/player.rb:6
           require at org/jruby/RubyKernel.java:1054
            (root) at /Users/myth/Learn/Code/Projects/bollywood/lib/bollywood.rb:1
           require at org/jruby/RubyKernel.java:1054
            (root) at /Users/myth/Learn/Code/Projects/bollywood/lib/bollywood.rb:2
           require at org/jruby/RubyKernel.java:1054
            (root) at /Users/myth/Learn/Code/Projects/bollywood/spec/spec_helper.rb:1
            (root) at /Users/myth/Learn/Code/Projects/bollywood/spec/spec_helper.rb:2
              load at org/jruby/RubyKernel.java:1073
            (root) at file:/Users/myth/.rvm/rubies/jruby-1.7.4/lib/jruby.jar!/jruby/kernel19/kernel.rb:1
              each at org/jruby/RubyArray.java:1617
  require_relative at file:/Users/myth/.rvm/rubies/jruby-1.7.4/lib/jruby.jar!/jruby/kernel19/kernel.rb:21
            (root) at /Users/myth/Learn/Code/Projects/bollywood/spec/bollywood_spec/player_spec.rb:1
            (root) at /Users/myth/.rvm/gems/jruby-1.7.4/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:1
   load_spec_files at /Users/myth/.rvm/gems/jruby-1.7.4/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819
rake aborted!
/Users/myth/.rvm/rubies/jruby-1.7.4/bin/jruby -S rspec spec/bollywood_spec/player_spec.rb failed
/Users/myth/.rvm/gems/jruby-1.7.4/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:156:in `run_task'
/Users/myth/.rvm/gems/jruby-1.7.4/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:124:in `initialize'
org/jruby/RubyBasicObject.java:1709:in `__send__'
org/jruby/RubyKernel.java:2213:in `send'
/Users/myth/.rvm/gems/jruby-1.7.4/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:122:in `initialize'
org/jruby/RubyProc.java:255:in `call'
org/jruby/RubyArray.java:1617:in `each'
org/jruby/RubyArray.java:1617:in `each'
org/jruby/RubyKernel.java:1073:in `load'
org/jruby/RubyKernel.java:1093:in `eval'
/Users/myth/.rvm/gems/jruby-1.7.4/bin/ruby_noexec_wrapper:14:in `(root)'

問題を解決するにはどうすればよいですか?

4

1 に答える 1

1

問題の解決策を見つけました:

MacOSX では、JNA がネイティブ ライブラリを見つけるためにNativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(),"/Applications/VLC .app/Contents/MacOS/lib");import ステートメントの前にいる必要があります。java_import 'uk.co.caprica.vlcj.binding.LibVlc'

于 2013-07-23T14:10:59.853 に答える