Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start jruby-complete.jar on Windows from UNC path #3661

Open
rsim opened this issue Feb 12, 2016 · 2 comments
Open

Cannot start jruby-complete.jar on Windows from UNC path #3661

rsim opened this issue Feb 12, 2016 · 2 comments

Comments

@rsim
Copy link

rsim commented Feb 12, 2016

It seems that require still does not fully support UNC paths on Winows. I identified different strange problems when starting java -jar with jruby-complete.jar from Windows UNC path (\\server\share\directory). Here is a simple example how to reproduce it with irb:

C:\>java -jar \\server\share\directory\jruby-complete-1.7.24.jar -S irb
LoadError: No such file to load -- irb/error.rb
        load at file://server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9/irb/locale.rb:112
  init_error at file://server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9/irb/init.rb:122
       setup at file://server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9/irb/init.rb:17
       start at file://server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9/irb.rb:53
      (root) at //server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/bin/jirb:13

Another strange psych require problem:

C:\>java -jar \\server\share\directory\jruby-complete-1.7.24.jar -e "require 'psych';p $LOADED_FEATURES.grep(/psych/)"
["jar:file://server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9/psych/exception.rb", "jar:file://server/share/directory/jruby-
complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9/psych/syntax_error.rb", "psych.jar"]

It is not clear why psych.jar appears in the loaded features as there is not such jar file in jruby-complete.jar. If jruby-complete.jar is located in a normal Windows drive directory then there is no such psych.jar in the loaded features (and there is a long list of psych .rb files).

I suspect that one of the causes could be that $LOAD_PATH is not populated correctly:

C:\>java -jar \\server\share\directory\jruby-complete-1.7.24.jar -e "p $:"
["file:/server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby", "file:/server/share/directory/jruby-complete-1.7.24.jar
!/META-INF/jruby.home/lib/ruby/shared", "file:/server/share/directory/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/1.9"]

In case of UNC path I think the correct prefix should be file://server/share/... and not file:/server/share/....

Are there any workaround how to run java command line with jruby-complete.jar from a Windows UNC path?

@rsim
Copy link
Author

rsim commented Feb 12, 2016

@enebo Could you please have a look on this? This is still one problem with UNC path support on Windows.

@rsim
Copy link
Author

rsim commented Feb 13, 2016

Found a workaround that I can use -Djruby.home=uri:classloader://META-INF/jruby.home in java command line and then $LOAD_PATH is populated with this JRUBY_HOME prefix and require works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant