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

fxml load error in jar #110

Open
dangnlg2 opened this issue Oct 30, 2016 · 3 comments
Open

fxml load error in jar #110

dangnlg2 opened this issue Oct 30, 2016 · 3 comments

Comments

@dangnlg2
Copy link

dangnlg2 commented Oct 30, 2016

OS : OS X El Capitan
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
Latest version of jrubyfx 1.1.1
(I also tried running it off master as well)

I am trying to launch a jrubyfx GUI in a jar from a Java application, but I am currently running into the following issue as it is having trouble finding my fxml file :

Exception running Application: <NoMethodError: undefined method 'open_stream' for nil:NilClass>

with my fxml_root is specified as :

fxml_root File.dirname(__FILE__)

which is in the same folder as the source code. I have tried to hard code the correct path into fxml_root, I then run into the following issue :

Exception running Application: #<NoMethodError: undefined method '[]' for nil:NilClass> /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-fxmlloader-0.4.1-java/lib/jrubyfx-fxmlloader.rb:144:in 'rputs' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-fxmlloader-0.4.1-java/lib/fxmlloader/real_elts.rb:130:in 'constructValue' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-fxmlloader-0.4.1-java/lib/fxmlloader/value_elts.rb:62:in 'processStartElement' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-fxmlloader-0.4.1-java/lib/jrubyfx-fxmlloader.rb:440:in 'processStartElement' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-fxmlloader-0.4.1-java/lib/jrubyfx-fxmlloader.rb:351:in 'load' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-1.1.1-java/lib/jrubyfx/controller.rb:126:in 'load_into' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-1.1.1-java/lib/jrubyfx/core_ext/stage.rb:82:in 'fxml' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/CSRR-0.1.0/lib/CSRR/swap.rb:87:in 'start' org/jruby/RubyBasicObject.java:1594:in 'instance_eval' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/jrubyfx-1.1.1-java/lib/jrubyfx/module.rb:49:in 'with' /Applications/MagicDraw/plugins/csrr/csrr_gemjar.jar!/gems/CSRR-0.1.0/lib/CSRR/swap.rb:86:in 'start' /Applications/Magic

any help is greatly appreciated.

@griest024
Copy link

I'm not at my computer right now so apologies if this is incorrect, but I believe that fxml_root takes a second argument that is the path relative to the root of the jar. I know that resource_root takes that second argument.

@dangnlg2
Copy link
Author

@griest024 I don't think so, fxml_root File.dirname(__FILE__) which basically declare that all FXML files are relative to the directory this script is in.

@bolandross
Copy link

Hey folks,

I just ran into a similar situation.
@dangnlg2 Did you find a solution?

When my JRuby Application is a jar, fxml_root always searches for the absolute path and can't find the fxml files that are located inside of the jar. How do you handle this? :-D

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

3 participants