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

Can't run build jar due to java.lang.NoClassDefFoundError #65

Closed
raLaaaa opened this issue Mar 29, 2020 · 6 comments
Closed

Can't run build jar due to java.lang.NoClassDefFoundError #65

raLaaaa opened this issue Mar 29, 2020 · 6 comments

Comments

@raLaaaa
Copy link

raLaaaa commented Mar 29, 2020

Hey there,

I imported the project to my IntelliJ.
Afterwards I ran the ./gradlew desktop:dist command from the root project folder.
Output states that the build has been succesfull.

Afterwards I run the build .jar with java -jar xxx.jar

It then states the following exception;

java.lang.NoClassDefFoundError: com/badlogic/gdx/ApplicationListener (sounds a little bit like my system can't find libgdx in the build .jar)

When trying trying to start the DesktopLauncher manually via my IDE the following exception comes up:

Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: ic_launcher\icon128.png (Internal)

I'm using newest IntelliJ Community Edition, Java 9 and build in Intellij Gradle. Any ideas why this happens? I'm assuming that it's a problem on my side.

Help or hints are much appreciated! Thanks for your work.

@Lonami
Copy link
Member

Lonami commented Mar 29, 2020

Maybe we shouldn't update gradle. See this answer on java.lang.NoClassDefFoundError (libgdx).

@raLaaaa
Copy link
Author

raLaaaa commented Mar 29, 2020

Ah thanks for the reply. What a pity.

@Lonami
Copy link
Member

Lonami commented Mar 29, 2020

I've re-ran the setup and used those files, pushed in commit 9c6be35. Could you try again? I've seen some fixes for the weird things one had to do before to change the assets location, so hopefully it's less of a pain to run now.

@raLaaaa
Copy link
Author

raLaaaa commented Mar 29, 2020

Thanks for your help. It still doesnt work but if i try to run the build application it now also displays the following exception (similiar to running the desktop launcher directly via IDE):

It can find the application listener though. So I think it's a step towards the right direction?

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: ic_launcher/icon128.png

@Lonami
Copy link
Member

Lonami commented Mar 29, 2020

It's weird it still fails like that. Note this line of the mentioned commit, it points to the android/assets folder which contains the ic_launcher/icon128.png file. I'm not sure why it's failing right now.

As a workaround you could try to copy the assets folder to whatever working directory you are on when running, but I haven't had that issue.

@raLaaaa
Copy link
Author

raLaaaa commented Mar 29, 2020

Copying assets in the working directoy fixed it for me! No idea why it exactly did not work though. Thanks for the help!

@raLaaaa raLaaaa closed this as completed Mar 29, 2020
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