Executable Jar creates split-second black screen

Anything libgdx related goes here!

Executable Jar creates split-second black screen

Postby terabix » Mon Mar 20, 2017 6:04 pm

I've finished a demonstrable part of my project and I'm packing it up for show into a .jar file.

I followed these instructions thus far:

https://github.com/libgdx/libgdx/wiki/D ... uxmac-os-x

It says it packed everything, code, assets, etc, into a .jar file.

When I run that .jar file, all it does is it creates a fullscreen black screen for a split second, then closes out. Nothing else.

Any way I can produce a bug report or diagnose what's going on? The code works fine otherwise.
terabix
 
Posts: 47
Joined: Mon Feb 20, 2017 8:05 pm

Re: Executable Jar creates split-second black screen

Postby evilentity » Mon Mar 20, 2017 6:07 pm

Run it from command line.
Need a freelancer? PM me!
evilentity
 
Posts: 3584
Joined: Wed Aug 24, 2011 11:37 am

Re: Executable Jar creates split-second black screen

Postby terabix » Mon Mar 20, 2017 8:20 pm

evilentity wrote:Run it from command line.


*facepalm*

I am such an inexperienced bonehead.

Anyways the command prompt says:

"Error: Could not find or load main class class overdrive_sample.jar" (overdrive_sample.jar is the executable jar)

I get what its saying, but how to I specify the main class from the export screen?
terabix
 
Posts: 47
Joined: Mon Feb 20, 2017 8:05 pm

Re: Executable Jar creates split-second black screen

Postby Thomas Creutzenberg » Mon Mar 20, 2017 10:37 pm

My guess mis that most likely the manifest.mf in the jar file in the META-INV folder does not contain a valid main-class entry. You should check out what .jar files need to run. This is most likely not a LibGDX problem...
Thomas Creutzenberg
 
Posts: 9
Joined: Mon Mar 31, 2014 9:34 am

Re: Executable Jar creates split-second black screen

Postby terabix » Mon Mar 20, 2017 11:24 pm

Thomas Creutzenberg wrote:My guess mis that most likely the manifest.mf in the jar file in the META-INV folder does not contain a valid main-class entry. You should check out what .jar files need to run. This is most likely not a LibGDX problem...


I opened up the jar file via 7-zip and checked the manifest file inside the META-INF folder.

Inside were these contents:

Code: Select all
Manifest-Version: 1.0
Class-Path: .
Main-Class: com.ftl.overdrive.driver


driver is the class where my main method is.

Is anything wrong?

If you want, I can send you the file if you can investigate and diagnose what's going on.
terabix
 
Posts: 47
Joined: Mon Feb 20, 2017 8:05 pm

Re: Executable Jar creates split-second black screen

Postby tenfour04 » Tue Mar 21, 2017 12:42 am

That error simply means you didn't type a valid path to the jar file on the command line.
tenfour04
 
Posts: 1044
Joined: Sat Jun 18, 2011 3:24 pm

Re: Executable Jar creates split-second black screen

Postby raeleus » Tue Mar 21, 2017 1:05 am

The command from the command line would be

Code: Select all
java -jar overdrive_sample.jar


assuming you have navigated to correct directory. Use the "cd" command to change directories.
Play Forward Gunner!
Create skins visually with Skin Composer.
raeleus
 
Posts: 251
Joined: Wed Aug 07, 2013 10:57 pm

Re: Executable Jar creates split-second black screen

Postby terabix » Tue Mar 21, 2017 1:33 pm

Ah, thank you. Now I'm getting a FileNotFound exception. This is strange. I'll have to investigate, but normally this is handled correctly in the main program.

Code: Select all
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: assets/Faster than Light/img/main_menus/main_base2.png
        at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:147)
        at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
        at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
        at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
        at com.ftl.overdrive.MainMenu.show(MainMenu.java:69)
        at com.badlogic.gdx.Game.setScreen(Game.java:61)
        at com.ftl.overdrive.FTLOverdrive_Main.create(FTLOverdrive_Main.java:14)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
        at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assets\Faster than Light\img\main_menus\main_base2.png (Internal)
        at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
        at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222)
        at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:144)
        ... 8 more


EDIT: I'm investigating the jar file and I'm not finding an assets folder containing the image and sound files that I packaged with my program. How do I include them with my executable jar file?
terabix
 
Posts: 47
Joined: Mon Feb 20, 2017 8:05 pm

Re: Executable Jar creates split-second black screen

Postby raeleus » Tue Mar 21, 2017 1:43 pm

It should automatically be included with your jar. Make sure you're using the dist gradle command and not trying to build the jar through your IDE like normal software. Please see the wiki.

Also, all your references to internal files should be accessed through "gdx.files.internal" and not "gdx.files.local". Local will work when running from your IDE, but not from the jar file.
Play Forward Gunner!
Create skins visually with Skin Composer.
raeleus
 
Posts: 251
Joined: Wed Aug 07, 2013 10:57 pm

Re: Executable Jar creates split-second black screen

Postby terabix » Tue Mar 21, 2017 2:24 pm

Found out how to do it:
https://github.com/libgdx/libgdx/wiki/G ... he-desktop

But it only lets me pack up the desktop project.

Doesn't have an instruction on how to pack the core project, which would make this much easier.

Later on I need to figure out how to make external assets and internal code interact to make a game modifiable by non-coders.
terabix
 
Posts: 47
Joined: Mon Feb 20, 2017 8:05 pm

Next

Return to Libgdx

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 4 guests