nelsonxb / GraphPaperRaceGame

Implementation of Racetrack (graph paper game)
MIT License
0 stars 0 forks source link

Create distributable standalone jar #2

Closed nelsonxb closed 9 years ago

nelsonxb commented 9 years ago

We need to be able to distribute this in a manner that makes it accessible.

This means a "fat jar" containing all dependencies that will auto-extract the LWJGL natives.

nelsonxb commented 9 years ago

I have started on this in a local branch (I might push it later, but it is certainly not ready to merge).

Gradle easily handles creating the fat jar easily (thanks to a plugin).

I am having trouble with extracting the natives though. I'm sure I managed this before, but for some reason I can't make it work correctly now.

Problem: Java can't seem to find the AppGameContainer class, even though it's included in the jar.

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.newdawn.slick.AppGameContainer
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
    at io.github.nelsoncrosby.gprg.GPRGame.<init>(GPRGame.groovy:43)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
    at io.github.nelsoncrosby.gprg.GPRGame.startGame(GPRGame.groovy:200)
    at io.github.nelsoncrosby.gprg.GPRGame.main(GPRGame.groovy:183)
nelsonxb commented 9 years ago

All working now (d8bc39baec189de13b6fdc77639e7dbeade7414c)