org.jruby.Main上的NoClassDefFoundError [英] NoClassDefFoundError on org.jruby.Main
问题描述
我正在尝试使用JRuby 1.4.0RC1在Windows机器上安装hpricot gem.我正在尝试遵循有关问题的建议(请参阅-> 为JRuby安装hpricot ).
I'm trying to install the hpricot gem on my Windows machine using JRuby 1.4.0RC1. I'm trying to follow the advice to the related question (see -> Installing hpricot for JRuby).
根据答案的建议,我拉开了hpricot的git头,并从其dir运行:
Per the answer's advice I pulled the git head of hpricot and from it's dir ran:
jruby -S rake package_jruby
cd pkg
sudo jgem install ./hpricot-0.8.1-jruby.gem
但是当我运行它时,出现以下NoClassDefFoundError:
But when I run this I get the following 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.
显然我的JRUBY_HOME \ lib \ jruby.jar迷路了.
Apparently my JRUBY_HOME\lib\jruby.jar is getting lost.
运行jruby -v可以正常工作,所以我对我的类路径混乱的地方感到困惑.
running jruby -v works fine, so I'm confused where my class path is getting messed up.
推荐答案
您的jruby安装似乎未完成.您是否抓住了bin
或src
dist?检查lib/jruby.jar
是否存在,确保bin/jruby
与lib/jruby.jar
处于同一jruby位置,然后测试java -jar lib/jruby.jar -e "puts 'hello'"
能否正常工作.
It looks like your jruby install isn't complete. Did you grab the bin
or 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.
这篇关于org.jruby.Main上的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!