为什么加载 jruby 的可执行 jar 不能在名称中包含空格(例如 Program files)的文件夹下运行?
我有一个加载 jruby 的可执行 jar。安装程序将 jar 和一些预打包的 jar 库(包括完整的 jruby 和一些 gems)放入安装位置。
一切工作正常,除了在 Windows 中,当 jar 安装到名称中包含空格的文件夹中时。当 Jruby 遇到来自 jar 打包的 gem 之一的简单“require”时,它会失败(状态机 gem 中的“require singleton”,如果这很重要的话)。
这本来不是什么大问题,但我需要 jar 从程序文件下运行。希望有人已经解决了这个问题:)
堆栈跟踪:
> Java::OrgJrubyExceptions::RaiseException - no such file to load --
> singleton file:/C:/<install
> location>/lib/java/state_machine-0.9.4.jar!/state_machine/matcher.rb:1:
> in `require': no such file to load -- singleton (LoadError)
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> matcher.rb:1
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> matcher.rb:1:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/ guard.rb:1
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> guard.rb:2:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/ event.rb:2
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> event.rb:6:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> machine.rb:6
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> machine.rb:1:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine. rb:1
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine. rb:1:in
> `require'
> from src/application.rb:1:in `require'
> from src/main.rb:54:in `require'
> from <script>:1
> ...internal jruby stack elided...
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!
> /state_machine/matcher.rb:1)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4
> .jar!/state_machine/matcher.rb:1)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar! /state_machine/guard.rb:1)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4 .jar!/state_machine/guard.rb:2)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar! /state_machine/event.rb:2)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4 .jar!/state_machine/event.rb:6)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!
> /state_machine/machine.rb:6)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4
> .jar!/state_machine/machine.rb:1)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar! /state_machine.rb:1)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4 .jar!/state_machine.rb:1)
> from Kernel.require(src/application.rb:1)
> from Kernel.require(src/main.rb:54)
> from Kernel.require(<script>:1)
> from (unknown).(unknown)(:1)
I have an executable jar that loads jruby. An installer drops the jar and some pre-packaged jar libraries (including complete jruby and some gems) into the install location.
Everything works fine except in Windows when the jar is installed into a folder with spaces in the name . Jruby fails when it encounters a simple "require" from one of the jar-packaged gems ("require singleton" in the statemachine gem if that matters).
This would have not been much of a problem but i need the jar to run from under program files. Hoping that someone out there has solved this :)
Stack trace:
> Java::OrgJrubyExceptions::RaiseException - no such file to load --
> singleton file:/C:/<install
> location>/lib/java/state_machine-0.9.4.jar!/state_machine/matcher.rb:1:
> in `require': no such file to load -- singleton (LoadError)
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> matcher.rb:1
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> matcher.rb:1:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/ guard.rb:1
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> guard.rb:2:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/ event.rb:2
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> event.rb:6:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> machine.rb:6
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine/
> machine.rb:1:in `require'
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine. rb:1
> from file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!/state_machine. rb:1:in
> `require'
> from src/application.rb:1:in `require'
> from src/main.rb:54:in `require'
> from <script>:1
> ...internal jruby stack elided...
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!
> /state_machine/matcher.rb:1)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4
> .jar!/state_machine/matcher.rb:1)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar! /state_machine/guard.rb:1)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4 .jar!/state_machine/guard.rb:2)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar! /state_machine/event.rb:2)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4 .jar!/state_machine/event.rb:6)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar!
> /state_machine/machine.rb:6)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4
> .jar!/state_machine/machine.rb:1)
> from Kernel.require(file:/C:/<install location>/lib/java/state_machine-0.9.4.jar! /state_machine.rb:1)
> from (unknown).(unknown)(file:/C:/<install location>/lib/java/state_machine-0.9.4 .jar!/state_machine.rb:1)
> from Kernel.require(src/application.rb:1)
> from Kernel.require(src/main.rb:54)
> from Kernel.require(<script>:1)
> from (unknown).(unknown)(:1)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是一个错误。您使用什么软件来创建可执行 jar?什么版本的 JRuby?我们过去已经处理过带有空格的文件名错误,但肯定还可能存在其他错误。您可以在 http://bugs.jruby.org 提交错误吗?谢谢。
It's probably a bug. What software did you use to create the executable jar? What version of JRuby? We've dealt with filenames-with-spaces bugs in the past, but there certainly could be others. Can you file a bug at http://bugs.jruby.org? Thanks.