You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
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. Ifrequire_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:
In the jar execution, using
require
seems to work. I have not tried to test this with instances ofrequire_relative
anywhere else (for instance in a file in a directory below the root of the jar file).The text was updated successfully, but these errors were encountered: