A Question About java_import

Does anyone know why I sometimes need to use quotations when using
java_import?

For instance, this works fine:

java_import com.badlogic.gdx.Gdx

But if I try and use this,

java_import box2dLight.RayHandler

it tells me it can’t find the library. But it works fine if I add the
quotes:

java_import 'box2dLight.RayHandler'

Is there something missing from the setup of the .jar? It’s not a big
deal, but I have no idea what’s going on.

My guess is this line of code:

https://github.com/jruby/jruby/blob/master/core/src/main/ruby/jruby/java/core_ext/kernel.rb#L3

So packages that start with java, javax, javafx, com, and org will work
without quotes, but for any other packages you will need to quote.

Ahh, thanks. That makes a lot of sense.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs