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

jrubyfx-jarify -ing the demo app (samples/fxml/Demo.rb) produces unusable Demo.jar. #86

Open
chrisrgue opened this issue Nov 10, 2014 · 3 comments

Comments

@chrisrgue
Copy link

I tried to jarify the Demo example (samples/fxml/Demo.rb) but the resulting Demo.jar file cannot be consumed by "java -jar Demo.jar" due to

LoadError: no such file to load -- classpath:/home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/complex_control

It seems like "complex_control.rb" is NOT attempted to be resolved from the Demo.jar itself (which contains that file) but instead is attempted to be resolved from the current working directory (which happens to be ~/wuala_synced_data/misc/JavaFX_projects/jrubyfx in my case) which apparently does not contain that file !?

cg@cg-TravelMate-6292 ~/wuala_synced_data/misc/JavaFX_projects/jrubyfx $ jrubyfx-jarify samples/fxml/ --main samples/fxml/Demo.rb Demo.jar && java -jar Demo.jar
mkdir -p /tmp/jrubyfx20141110-20239-zmjsjl
cp /home/cg/.jruby-jar/jruby-complete-1.7.9.jar /tmp/jrubyfx20141110-20239-zmjsjl/Demo.jar
cp -r samples/fxml//ComplexControl.fxml /tmp/jrubyfx20141110-20239-zmjsjl/ComplexControl.fxml
cp -r samples/fxml//Demo.fxml /tmp/jrubyfx20141110-20239-zmjsjl/Demo.fxml
cp -r samples/fxml//Demo.rb /tmp/jrubyfx20141110-20239-zmjsjl/Demo.rb
cp -r samples/fxml//complex_control.rb /tmp/jrubyfx20141110-20239-zmjsjl/complex_control.rb
cp samples/fxml/Demo.rb /tmp/jrubyfx20141110-20239-zmjsjl/jar-bootstrap.rb
cp -r /home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/lib/jrubyfx /tmp/jrubyfx20141110-20239-zmjsjl
cp -r /home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/lib/jrubyfx.rb /tmp/jrubyfx20141110-20239-zmjsjl
cp -r /home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/lib/jrubyfx_tasks.rb /tmp/jrubyfx20141110-20239-zmjsjl
cp -r /home/cg/.rvm/gems/jruby-1.7.9/gems/jrubyfx-fxmlloader-0.3-java/lib/FXMLLoader-j8.jar /tmp/jrubyfx20141110-20239-zmjsjl
cp -r /home/cg/.rvm/gems/jruby-1.7.9/gems/jrubyfx-fxmlloader-0.3-java/lib/fxmlloader /tmp/jrubyfx20141110-20239-zmjsjl
cp -r /home/cg/.rvm/gems/jruby-1.7.9/gems/jrubyfx-fxmlloader-0.3-java/lib/jrubyfx-fxmlloader.rb /tmp/jrubyfx20141110-20239-zmjsjl
cd /tmp/jrubyfx20141110-20239-zmjsjl
jar ufe 'Demo.jar' org.jruby.JarBootstrapMain *
chmod 775 Demo.jar
cd /home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx
mv /tmp/jrubyfx20141110-20239-zmjsjl/Demo.jar Demo.jar
rm -rf /tmp/jrubyfx20141110-20239-zmjsjl
LoadError: no such file to load -- classpath:/home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/complex_control
require at org/jruby/RubyKernel.java:1083
require at jar:file:/home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/Demo.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
require at jar:file:/home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/Demo.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
require_relative at file:/home/cg/wuala_synced_data/misc/JavaFX_projects/jrubyfx/Demo.jar!/jruby/kernel19/kernel.rb:21
(root) at classpath:jar-bootstrap.rb:21
cg@cg-TravelMate-6292 ~/wuala_synced_data/misc/JavaFX_projects/jrubyfx $

By the way: I am using jurby-1.7.9:

cg@cg-TravelMate-6292 ~/wuala_synced_data/misc/JavaFX_projects/jrubyfx $ jruby -v
jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on Java HotSpot(TM) Server VM 1.7.0_60-b19 [linux-i386]
cg@cg-TravelMate-6292 ~/wuala_synced_data/misc/JavaFX_projects/jrubyfx $

@vpereira
Copy link

vpereira commented Dec 8, 2014

I would recommend you to update your jruby. Up to the jruby 1.7.10 there were some problems related with require_relative and File.expand_path that may or may not be related with your problem

@vpereira
Copy link

vpereira commented Dec 8, 2014

I did update my jruby to 1.7.16 and I have a similar problem:

vpereira@linux-8njk:~/jrubyfx/samples> java -jar demo.jar
file:/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/utils/common_converters.rb:28 warning: already initialized constant ARG_CONVERTER_SUFFIX
file:/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/utils/common_converters.rb:31 warning: already initialized constant NAME_TO_COLORS
file:/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/utils/common_converters.rb:137 warning: already initialized constant CONVERTERS
file:/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/utils/common_converters.rb:172 warning: already initialized constant ENUM_CACHE
file:/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/utils/common_converters.rb:175 warning: already initialized constant ENUM_OVERRIDES
Exception running Application:
#<NoMethodError: undefined method `[]' for nil:NilClass>
/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/controller.rb:352:in `get_fxml_loader'
/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/controller.rb:123:in `load_into'
classpath:jar-bootstrap.rb:44:in `start'
/home/vpereira/jrubyfx/samples/demo.jar!/jrubyfx/java_fx_impl.rb:119:in `launch_app_after_platform'
org/jruby/gen/InterfaceImpl1800809230.gen:13:in `run'

could be that somehow the fxml_root isn't being used and the jar cannot find the fxml?

@vpereira
Copy link

vpereira commented Dec 8, 2014

probably related with #74

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

2 participants