简体   繁体   English

org.jruby.Main上的NoClassDefFoundError

[英]NoClassDefFoundError on org.jruby.Main

I'm trying to install the hpricot gem on my Windows machine using JRuby 1.4.0RC1. 我正在尝试使用JRuby 1.4.0RC1在我的Windows机器上安装hpricot gem。 I'm trying to follow the advice to the related question (see -> Installing hpricot for JRuby ). 我正在尝试遵循相关问题的建议(请参阅 - > 为JRuby安装hpricot )。

Per the answer's advice I pulled the git head of hpricot and from it's dir ran: 根据答案的建议,我拉了hpricot的git head并从它的dir ran:

jruby -S rake package_jruby
cd pkg
sudo jgem install ./hpricot-0.8.1-jruby.gem

But when I run this I get the following NoClassDefFoundError: 但是当我运行它时,我得到以下NoClassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/Main
Caused by: java.lang.ClassNotFoundException: org.jruby.Main
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: org.jruby.Main.  Program will exit.

Apparently my JRUBY_HOME\\lib\\jruby.jar is getting lost. 显然我的JRUBY_HOME \\ lib \\ jruby.jar迷路了。

running jruby -v works fine, so I'm confused where my class path is getting messed up. 运行jruby -v工作正常,所以我很困惑我的类路径搞砸了。

It looks like your jruby install isn't complete. 看起来你的jruby安装不完整。 Did you grab the bin or src dist? 你抓住bin还是src dist? Check if lib/jruby.jar exists, make sure bin/jruby is in the same jruby location as lib/jruby.jar , and test java -jar lib/jruby.jar -e "puts 'hello'" to see if it's functional. 检查lib/jruby.jar存在,确保bin/jrubylib/jruby.jar位于同一个jruby位置,并测试java -jar lib/jruby.jar -e "puts 'hello'"以查看它是否正常运行。

I suspect sudo does not inherit your environment variables. 我怀疑sudo没有继承你的环境变量。 So JRUBY_HOME is gone. 所以JRUBY_HOME走了。 Try to add it to jgem profile. 尝试将其添加到jgem配置文件。

I'm on Windows. 我在Windows上。 I'm not sure if JRuby 1.4 drops the 'j' prefix. 我不确定JRuby 1.4是否会删除'j'前缀。 jgem isn't recognized, but gem is. jgem不被认可,但宝石是。 Regardless, when I gem environment I get: 无论如何,当我获得宝石环境时:

C:\tmp\hpricot>gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.8.7 (2009-09-30 patchlevel 174) [java]
  - INSTALLATION DIRECTORY: C:/jruby-1.4.0RC1/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: C:/jruby-1.4.0RC1/bin/../bin/jruby.bat
  - EXECUTABLE DIRECTORY: C:/jruby-1.4.0RC1/bin/../bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6
  - GEM PATHS:
     - C:/jruby-1.4.0RC1/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--env-shebang"
     - "update" => "--env-shebang"
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 设置org.jruby.Main的类路径? - Setting classpath for org.jruby.Main? Windows 10上的JRuby全新安装-无法找到或加载主类org.jruby.Main - JRuby fresh install on Windows 10 - Could not find or load main class org.jruby.Main 线程“main”中的异常 java.lang.NoClassDefFoundError: org/hamcrest/Matchers - Exception in thread "main" java.lang.NoClassDefFoundError: org/hamcrest/Matchers “主要” java.lang.NoClassDefFoundError:org / apache / http / HttpEntity - “main” java.lang.NoClassDefFoundError: org/apache/http/HttpEntity 线程主 NoClassDefFoundError 中的异常:org/springframework/boot/SpringApplication - Exception in thread main NoClassDefFoundError: org/springframework/boot/SpringApplication “线程”main“中的异常 java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing” - “Exception in thread ”main“ java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing” 线程“main”中的异常java.lang.NoClassDefFoundError:org / reactivestreams / Publisher? - Exception in thread “main” java.lang.NoClassDefFoundError: org/reactivestreams/Publisher? 线程“main”中的异常 java.lang.NoClassDefFoundError: org/jsoup/Jsoup - Exception in thread "main" java.lang.NoClassDefFoundError: org/jsoup/Jsoup “主要” java.lang.NoClassDefFoundError:org / jdom / JDOMException - “main” java.lang.NoClassDefFoundError: org/jdom/JDOMException 线程“ main”中的异常java.lang.NoClassDefFoundError:org / mockito / Mockito - Exception in thread “main” java.lang.NoClassDefFoundError: org/mockito/Mockito
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM