I guess I’m confused. Can you clarify a few things for me?
Are you saying that even if the “def initialize” is before the
“java_import”, the “java_import” runs first? They should happen in the
order they’re encountered in the code.
Why do you need to have this method defined before you import that
class?
I think I might have seen some discussion about this that indicated
you are using a precompiled .rb class, yes? In that case, imports may
be loaded earlier than the rest of the script. You could try to move
the imports to a separate script.
I may be missing something here, but I think the problemis that
java_import is evaluated when the class is loaded, whereas the
modification to @vlc_path is not happening until the class’ instance is
created.
Is the java_import inside the initialize() method? Also, how is the
java_import going to know anything about @vlc_path? I don’t know
anything about NativeLibrary.addSearchPath(), but did you mean to use @vlc_path in that call?
You could put the java_import in the initialize…or in a “singleton”
initialization method somewhere in your system you call only once. It
sounds like the it’s loading in expected order based on the way you
have it laid out.