我有一个 jar 文件,其中有一个我想从我的 Rails 项目中使用的类。我尝试使用这些命令导入带有 Rjb 的类。jar 文件位于 bin 目录中。
Rjb.load("#{Rails.root}/bin")
=> nil
Rjb::add_jar("excel_tools.jar")
=> true
Rjb::import("tools.CellEditor")
ClassNotFoundException: tools.CellEditor
Rjb::import("tools/CellEditor")
ClassNotFoundException: tools.CellEditor
类名“tools.CellEditor”应该是正确的。至少当我在终端中列出 jar 中的类时,我会从 apache poi 和 log4j 中得到这个以及更多的类。
$ jar tvf bin/excel_tools.jar
6926 Mon Aug 25 13:24:00 EEST 2014 tools/CellEditor.class
知道 jar 或类加载出错的地方吗?