Skip to content

get_fxml_loader seems to work differently when in jar #74

@amiracam

Description

@amiracam

So I have managed to pack up app in a jar which then upon launching the jar I encounter this:

 fx.location =
      if JRubyFX::Application.in_jar?
      # If we are in a jar file, use the class loader to get the file from the jar (like java)
      # TODO: should just be able to use URLs
      JRuby.runtime.jruby_class_loader.get_resource File.join(root_dir, filename)
    else
      root_dir ||= fxml_root
      # If we are in the normal filesystem, create a file url path relative to relative_to or this file
      URL.new "file:#{File.join root_dir, filename}"
    end

the app upon launching ie.

  java -jar myjar.jar

crashes in the attempt to do the file join because <root_dir> is nil although fxml_root was specified in the app.

Launching the app works outside of the jar , where there's protection in place to assure that root_dir has fxml_root .

From a quick glance it seems that root_dir should have? been picked up via "settings" but apparently its not. Have to go now, I'll spend more time on this tomorrow.

Here's the debug stack:

root dir : 
filename : amn_main_ui2.fxml
Exception running Application:
#<TypeError: can't convert nil into String>
org/jruby/RubyFile.java:1895:in `join'
org/jruby/RubyFile.java:826:in `join'
/Users/charles/.rvm/gems/jruby-1.7.6/gems/jrubyfx-1.1.0-java/lib/jrubyfx/controller.rb:341:in `get_fxml_loader'
/Users/charles/.rvm/gems/jruby-1.7.6/gems/jrubyfx-1.1.0-java/lib/jrubyfx/controller.rb:117:in `load_into'
./lib/amn_main_ui.rb:19:in `start'
/Users/charles/.rvm/gems/jruby-1.7.6/gems/jrubyfx-1.1.0-java/lib/jrubyfx/java_fx_impl.rb:125:in `launch_app_after_platform'
org/jruby/gen/InterfaceImpl1217949027.gen:13:in `run'
loading amn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions