-
-
Notifications
You must be signed in to change notification settings - Fork 942
Description
Environment
Provide at least:
- JRuby version:
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.65-b01 on 1.8.0_65-b17 +jit [linux-x86_64]
- Operating system and platform
Linux bigblue 4.4.16-desktop-1.mga5 #1 SMP Tue Jul 26 09:23:40 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Other relevant info you may wish to add:
- Installed or activated gems
Just bundler
- Application/framework version (e.g. Rails, Sinatra)
jrubyfx
Expected Behavior
Load any file in a jar using require_relative
The jrubyfx-9k-jar-problems repo can be re-purposed for this bug, as a follow up to #4000
Actual Behavior
The actual behavior is that require_relative "lib/brakeman_pro" can't find the file. But if you just move the file to lib2/brakeman_pro.rb and require that, it works!
I build the jar like this:
$ gem install bundler
$ TMPDIR=~/tmp/ rake
Then I run
$ java -jar BrakemanPro.jar
uri:classloader:/vendor/bundle/jruby/2.3.0/gems/jrubyfx-fxmlloader-0.4.1-java/lib/fxmlloader/elts.rb:158: warning: `<<' after local variable or literal is interpreted as binary operator
uri:classloader:/vendor/bundle/jruby/2.3.0/gems/jrubyfx-fxmlloader-0.4.1-java/lib/fxmlloader/elts.rb:158: warning: even though it seems like here document
Errno::ENOENT: No such file or directory - uri:classloader:/usr/lib/brakeman_pro.rb
realpath at org/jruby/RubyFile.java:812
require_relative at uri:classloader:/jruby/kernel/kernel.rb:11
<main> at uri:classloader:/lib/brakeman_pro.rb:4
require at org/jruby/RubyKernel.java:956
(root) at uri:classloader:/jruby/kernel/kernel.rb:1
<main> at classpath:/jar-bootstrap.rb:2
I have tried with JRuby 9.1.3.0, 9.1.4.0, and 9.1.5.0. They all show the same behavior.
A jar built on OSX works on OSX but shows the same error if I run that jar on Linux.
After spending several hours on this, I realized the first require_relative in the bootstrap file works just fine, which baffled me. So I tested requiring other files in different directories and the root directory. They worked just fine. An unsettling realization came over me. I changed move the file to lib2, adjusted the require_relative call and...it worked. 😱