Skip to content

Initial $LOAD_PATH depends on JRUBY_HOME in jruby-complete-9.0.0.0 #3257

@CeesZ

Description

@CeesZ

The default $LOAD_PATH for jruby-complete-9.0.0.0 depends on the environment variable JRUBY_HOME
In my opinion that is not desirable if you are running an application in a JAR, when you
need the initial $LOAD_PATH for access to the standard libraries and do not want
(accidental) interference with the libraries from outside the JAR.
If an application wants to take note of JRUBY_HOME it should do so by inspecting the
environment variable itself.
jruby-complete-1.7.19 did NOT depend on JRUBY_HOME, see following example:

C:\Projects\XLibriz\lib\java>CD C:\Projects\XLibriz\lib\java

SET JRUBY_HOME=C:\jruby-1.7.19

java -jar jruby-complete-1.7.19.jar -e "puts $LOAD_PATH.join("\n");"
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/shared
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/1.9

java -jar jruby-complete-9.0.0.0.jar -e "puts $LOAD_PATH.join("\n");"
Warning: JRuby home "C:/jruby-1.7.19" does not exist, using C:\Users\user\AppData\Local\Temp
C:/Users/user/AppData/Local/Temp/lib/ruby/2.2/site_ruby
C:/Users/user/AppData/Local/Temp/lib/ruby/stdlib

SET JRUBY_HOME=C:\Data (existing directory, no Ruby files)

java -jar jruby-complete-1.7.19.jar -e "puts $LOAD_PATH.join("\n");"
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/shared
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/1.9

java -jar jruby-complete-9.0.0.0.jar -e "puts $LOAD_PATH.join("\n");"
C:/Data/lib/ruby/2.2/site_ruby
C:/Data/lib/ruby/stdlib

SET JRUBY_HOME=

java -jar jruby-complete-1.7.19.jar -e "puts $LOAD_PATH.join("\n");"
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/shared
file:/C:/Projects/jruby-complete-1.7.19.jar!/META-INF/jruby.home/lib/ruby/1.9

java -jar jruby-complete-9.0.0.0.jar -e "puts $LOAD_PATH.join("\n");"
uri:classloader:/META-INF/jruby.home/lib/ruby/2.2/site_ruby
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions