-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Issue
After jarifying samples\fxml\Demo.rb, executing the jar file produces a LoadError for the require_relative statement in Demo.rb (around line 21). More precisely, the line
require_relative 'complex_control'
results in the error message
LoadError: no such file to load -- classpath:C:/complex_control
My guess is that this has something to do with the behavior of __FILE__ inside of a jar. If require_relative is implemented by referring to __FILE__, and __FILE__ doesn't behave properly inside a jar, that would help explain the trouble. The drive designation "C:" that appears in the error message does not appear when I call __FILE__, so I don't know where that comes from.
Workaround
In Demo.rb, replace the line
require_relative 'complex_control'
with the following lines:
if JRubyFX::Application.in_jar? then
require 'complex_control'
else
require_relative 'complex_control'
end
In the jar execution, using require seems to work. I have not tried to test this with instances of require_relative anywhere else (for instance in a file in a directory below the root of the jar file).