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

jar for libGDX JRuby game crashes #492

Open
jrab89 opened this issue Apr 9, 2021 · 0 comments
Open

jar for libGDX JRuby game crashes #492

jrab89 opened this issue Apr 9, 2021 · 0 comments

Comments

@jrab89
Copy link

jrab89 commented Apr 9, 2021

I'm trying to package a minimal libGDX game written in JRuby with Warbler. The game works when run from the command-line, but when I run the jar built by Warbler, it crashes. Here's the source for this minimal game: https://github.com/jrab89/hello_libgdx_jruby

Here's how to run the game from the command-line (results in a graphical window that says "hello libgdx!"):

$ git clone [email protected]:jrab89/hello_libgdx_jruby.git
Cloning into 'hello_libgdx_jruby'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 10 (delta 0), reused 10 (delta 0), pack-reused 0
Receiving objects: 100% (10/10), done.
$ cd hello_libgdx_jruby
$ ruby -v
jruby 9.2.14.0 (2.5.7) 2020-12-08 ebe64bafb9 Java HotSpot(TM) 64-Bit Server VM 25.172-b11 on 1.8.0_172-b11 +jit [darwin-x86_64]
$ bundle install
Using rake 13.0.3
Using ast 2.4.2
Using thread_safe 0.3.6 (java)
Using descendants_tracker 0.0.4
Using ice_nine 0.11.2
Using axiom-types 0.1.1
Using bundler 1.17.3
Using coderay 1.1.3
Using coercible 1.0.0
Using diff-lcs 1.4.4
Using equalizer 0.0.11
Using ffi 1.14.2 (java)
Using jar-dependencies 0.4.1
Using virtus 1.0.5
Using maven-tools 1.1.6
Using ruby-maven-libs 3.3.9
Using ruby-maven 3.3.12
Using jbundler 0.9.3
Using jruby-jars 9.2.14.0
Using jruby-rack 1.1.21
Using method_source 1.0.0
Using parallel 1.20.1
Using parser 3.0.0.0
Using spoon 0.0.6
Using pry 0.13.1 (java)
Using rainbow 3.0.0
Using regexp_parser 2.0.3
Using rexml 3.2.4
Using rspec-support 3.10.2
Using rspec-core 3.10.1
Using rspec-expectations 3.10.1
Using rspec-mocks 3.10.2
Using rspec 3.10.0
Using rubocop-ast 1.4.1
Using ruby-progressbar 1.11.0
Using unicode-display_width 2.0.0
Using rubocop 1.9.1
Using rubyzip 1.3.0
Using warbler 2.0.5
Bundle complete! 5 Gemfile dependencies, 39 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ jbundle
...

jbundler provided classpath:
----------------

jbundler runtime classpath:
---------------------------
/Users/jeff.rabovsky/.m2/repository/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar
/Users/jeff.rabovsky/.m2/repository/org/yaml/snakeyaml/1.26/snakeyaml-1.26.jar
/Users/jeff.rabovsky/.m2/repository/com/badlogicgames/gdx/gdx-platform/1.9.14/gdx-platform-1.9.14-natives-desktop.jar
/Users/jeff.rabovsky/.m2/repository/org/lwjgl/lwjgl/lwjgl_util/2.9.3/lwjgl_util-2.9.3.jar
/Users/jeff.rabovsky/.m2/repository/com/badlogicgames/jlayer/jlayer/1.0.1-gdx/jlayer-1.0.1-gdx.jar
/Users/jeff.rabovsky/.m2/repository/org/lwjgl/lwjgl/lwjgl-platform/2.9.3/lwjgl-platform-2.9.3-natives-linux.jar
/Users/jeff.rabovsky/.m2/repository/org/lwjgl/lwjgl/lwjgl-platform/2.9.3/lwjgl-platform-2.9.3-natives-osx.jar
/Users/jeff.rabovsky/.m2/repository/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar
/Users/jeff.rabovsky/.m2/repository/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar
/Users/jeff.rabovsky/.m2/repository/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar
/Users/jeff.rabovsky/.m2/repository/org/lwjgl/lwjgl/lwjgl-platform/2.9.3/lwjgl-platform-2.9.3-natives-windows.jar
/Users/jeff.rabovsky/.m2/repository/org/jcraft/jorbis/0.0.17/jorbis-0.0.17.jar
/Users/jeff.rabovsky/.m2/repository/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar
/Users/jeff.rabovsky/.m2/repository/jline/jline/2.14.6/jline-2.14.6.jar
/Users/jeff.rabovsky/.m2/repository/com/badlogicgames/gdx/gdx/1.9.14/gdx-1.9.14.jar
/Users/jeff.rabovsky/.m2/repository/org/lwjgl/lwjgl/lwjgl/2.9.3/lwjgl-2.9.3.jar
/Users/jeff.rabovsky/.m2/repository/com/badlogicgames/gdx/gdx-backend-lwjgl/1.9.14/gdx-backend-lwjgl-1.9.14.jar

jbundler test classpath:
------------------------
	--- empty ---

jbundle complete !

$ bundle exec bin/hello_libgdx_jruby

However, if I warble in the same directory and run the resulting jar, the game crashes:

$ bundle exec warble
rm -f hello_libgdx_jruby.jar
Creating hello_libgdx_jruby.jar
$ java -jar hello_libgdx_jruby.jar
Exception in thread "LWJGL Application" java.lang.NoClassDefFoundError: org/lwjgl/opengl/Display$2
	at org.lwjgl.opengl.Display.<clinit>(Display.java:126)
	at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setVSync(LwjglGraphics.java:643)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:125)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.Display$2
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 3 more
AL lib: (EE) alc_cleanup: 1 device not closed

Please let me know if more information is needed. Thanks for your help.

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

1 participant