Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7824353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:34:11+00:00 2026-06-02T08:34:11+00:00

I am running Jruby 1.6.7 in ruby 1.8 I can install the gem: https://github.com/consti/tupalo-kdtree

  • 0

I am running Jruby 1.6.7 in ruby 1.8

I can install the gem: https://github.com/consti/tupalo-kdtree.

I have the code below:

require 'kdtree'
require 'benchmark'



  def setup_tree(len)
    @points = (0...len).map { |i| [rand_coord, rand_coord, i ] }
    @kdtree = KDTree.new(@points)
  end

  def distance(a, b)
    x, y = a[0] - b[0], a[1] - b[1]
    x * x + y * y
  end

  def rand_coord
    rand(0) * 10 - 5
  end





  def test_nearestk

    pt = []
    @list = []
    20000.times do
      pt = [rand_coord, rand_coord]
     # kdtree search
      @list << @kdtree.nearest(pt[0],pt[1])     #puts pt

      end
       puts "Points from search #{@list.size}"
       puts "Points in graph #{@kdsize}"

  end
   @kdsize = 50000 
   setup_tree(@kdsize)
Benchmark.bm do |x| 
  x.report do
test_nearestk
end
end

However when I run this in Jruby – I get the error

LoadError: no such file to load -- kdtree
  require at org/jruby/RubyKernel.java:982
  require at /home/charlie/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/custom_require.rb:36
   (root) at newtest.rb:2

Its odd, as it is saying it can’t even find kdtree – when I know it is there – the gem installed. I have cleaned out the gemset and created a new one under RVM but still the same error. Is there a different way of ‘require’ under jruby? Or is there something else wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:34:13+00:00Added an answer on June 2, 2026 at 8:34 am

    Add this to the top

    require 'rubygems'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I have Ruby and JRuby on the same Windows 7 machine without running
I'm looking at ways to deploy a Ruby on Rails app (running on JRuby)
So, I have rvm installed on my machine, and I type: rvm install jruby
Im using Jruby (thats ruby anyway, running under jvm :D ) with marathon test
Trying to install some gems under jruby 1.6, but getting connection refused: $ gem
I'm running Aptana 3.0.6 on Windows XP I also have JRuby 1.6.4 installed and
i have ubuntu 8.10, running glassfish v3 (not prelude). first deployment of any jruby
Is there a default folder where WEBrick will search for jars when running JRuby
I'm getting the following error when running warble under both jRuby 1.3 and 1.4.
Running FxCop on my code, I get this warning: Microsoft.Maintainability : 'FooBar.ctor is coupled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.