无法加载 JRubyEngine,因为找不到 org.apache.bsf.util.BSFEngineImpl
我正在尝试在自定义应用程序中使用 JRuby,但似乎无法加载 JRubyEngine
对象。我的课程在功能上看起来与此类似:
public class ScriptEngine {
private static ScriptEngine engine = new JRubyEngine();
public void run(final String script, final Map<String,Object> input) {
final Bindings context = engine.createBindings();
context.putAll(input);
try {
engine.eval(script,context);
} catch (ScriptException e) {
log.error("Failed to execute script: "+getScript(),e);
}
}
}
但是,这在编译时失败并抱怨:
[javac] Compiling 486 source files to /workspace/myProject/build/src
[javac] /workspace/myProject/src/net/ceilingfish/ScriptEngine.java:31: cannot access org.apache.bsf.util.BSFEngineImpl
[javac] class file for org.apache.bsf.util.BSFEngineImpl not found
[javac] private static ScriptEngine engine = new JRubyEngine();
[javac] ^
[javac] 1 error
有人对我可以从哪里获得该课程有任何见解吗?或者是否有更好的方法来实例化 JRubyEngine 对象。
I'm trying to use JRuby in a custom application, and I don't seem to be able to load the JRubyEngine
object. My class looks like functionally similar to this:
public class ScriptEngine {
private static ScriptEngine engine = new JRubyEngine();
public void run(final String script, final Map<String,Object> input) {
final Bindings context = engine.createBindings();
context.putAll(input);
try {
engine.eval(script,context);
} catch (ScriptException e) {
log.error("Failed to execute script: "+getScript(),e);
}
}
}
However this fails at compilation with the complaint:
[javac] Compiling 486 source files to /workspace/myProject/build/src
[javac] /workspace/myProject/src/net/ceilingfish/ScriptEngine.java:31: cannot access org.apache.bsf.util.BSFEngineImpl
[javac] class file for org.apache.bsf.util.BSFEngineImpl not found
[javac] private static ScriptEngine engine = new JRubyEngine();
[javac] ^
[javac] 1 error
Does anyone have any insights on where I can get this class from? Or if there is a better way to be instantiating a JRubyEngine object.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以从 http://jakarta.apache.org/site/downloads/ 下载 Apache BSF downloads_bsf.cgi
You can download Apache BSF from http://jakarta.apache.org/site/downloads/downloads_bsf.cgi
事实证明我应该使用
JRubyScriptEngine
而不是JRubyEngine
。例如Turns out I should have been using
JRubyScriptEngine
notJRubyEngine
. e.g.