Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 java 应用程序,打包到一个 .EAR 文件中,其中包含使用脚本容器在 JRuby 中运行的代码。 ruby 代码运行正常,除非它需要一些打包到同一个 .EAR 文件中的其他文件。
puts "x"; require 'my_other_ruby_file.rb';
导致此错误:
LoadError: no such file to load --my_other_ruby_file
有人有什么想法吗?
提前致谢。
以这种方式加载文件需要它们在应用程序的类路径中可见。因此,根据您的 EAR 布局,您需要确保部署 JRuby 应用程序的部分可以看到 .rb 文件所在的部分。
除此之外,它只是标准的 EAR 类路径行为。