我有一个加载jruby的可执行jar。安装程序将jar和一些预打包的jar库(包括完整的jruby和一些gems)放入安装位置。

将jar安装到名称带有空格的文件夹中时,除了在Windows中以外,一切正常。当Jruby遇到其中一个jar打包的gem中的一个简单的“ require”(如果重要的话,它在statemachine 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)

最佳答案

这可能是一个错误。您使用什么软件来创建可执行jar?什么版本的JRuby?过去我们已经处理过带空格的文件名错误,但是肯定还有其他错误。您可以在http://bugs.jruby.org处提交错误吗?谢谢。

关于java - 为什么加载jruby的可执行jar无法在名称带有空格的文件夹(例如,程序文件)下运行?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8446868/

10-11 22:33
查看更多