我有一个由java half和ruby half组成的程序。当我将java half编译成jar时,一切正常。当我只有原始.class文件时,ruby可以引用SimpleStringProperty
,但是当我引用引用SimpleStringProperty
的java类时,java给出:
LoadError: load error: designer -- java.lang.NoClassDefFoundError: javafx/beans/property/SimpleStringProperty
我已经能够将它减少到三个文件:一个引用javafx的java文件,一个不引用javafx的java文件,以及一个包含以下内容的ruby文件:
require 'jrubyfx' # requires ruby javafx bindings
require 'my.jar' # I ommit this line when using the raw .class files
p Java::javafx.beans.property.SimpleStringProperty
p Java::mypackage.NoJavaFX
p Java::mypackage.RefJavaFX
在我的cwd中使用jar运行时,我将其作为jruby -I . main.rb
运行并输出:
Java::JavafxBeansProperty::SimpleStringProperty
Java::Mypackage::NoJavaFX
Java::Mypackage::RefJavaFX
然而,当我使用$ CWD / mypackage /中的.class文件作为jruby -I . main.rb
运行它并输出:
Java::JavafxBeansProperty::SimpleStringProperty
Java::Mypackage::NoJavaFX
Class.java:-2:in `getDeclaredMethods0': java.lang.NoClassDefFoundError: javafx/beans/property/SimpleStringProperty
from Class.java:2451:in `privateGetDeclaredMethods'
from Class.java:1810:in `getDeclaredMethods'
from JavaClass.java:2089:in `getMethods'
from JavaClass.java:989:in `setupClassMethods'
from JavaClass.java:97:in `access$700'
from JavaClass.java:653:in `initialize'
from JavaClass.java:694:in `setupProxy'
from Java.java:574:in `createProxyClass'
from Java.java:502:in `createProxyClassForClass'
from JavaSupport.java:154:in `computeValue'
...snip...
Caused by:
URLClassLoader.java:366:in `run': java.lang.ClassNotFoundException: javafx.beans.property.SimpleStringProperty
from URLClassLoader.java:355:in `run'
from AccessController.java:-2:in `doPrivileged'
from URLClassLoader.java:354:in `findClass'
from ClassLoader.java:423:in `loadClass'
from Launcher.java:308:in `loadClass'
from ClassLoader.java:356:in `loadClass'
from Class.java:-2:in `getDeclaredMethods0'
from Class.java:2451:in `privateGetDeclaredMethods'
from Class.java:1810:in `getDeclaredMethods'
from JavaClass.java:2089:in `getMethods'
from JavaClass.java:989:in `setupClassMethods'
from JavaClass.java:97:in `access$700'
...snip...
这让我相信有两个宇宙
我迷失了如何解决这个问题。非常感谢。