Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (532)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  [LibGdx] - Exported to Jar, and Gamescreen wont show, but other Screens will?  (Read 1631 times)
0 Members and 1 Guest are viewing this topic.
Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Posted 2014-01-05 14:52:35 »

All right, so i have exported a game i have created to an runnable jar file as i have many times before. Earlier i haven't had a problem like this, the last time i exported it was on friday, and now when the last version is finished and i export it, the window just closes when i have gone trough a few screens, flash, credits and menu, no error is given if i run it trough commandline. The game works fine if i run it trough eclipse. I have checked the buildpath and the asset folder is there and all. I have opened the jar with winrar and checked to see that all images are there, and they are. I have tried both to extract and package the libraries. I am at a total loss....

I looked around and only could find one thread on this, and that was an error with a static filepath.

I really need this fixed since it's supposed to be turned in on tuesday. :/
Offline Andre Lopes
« Reply #1 - Posted 2014-01-05 17:27:57 »

Do me a favor, post the main code here.

After that, wrap it inside a try { }catch(Exception ex) { JOptionPane.showMessageDialog(null,"" + ex.getMessage);
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #2 - Posted 2014-01-05 18:08:42 »

To do something easier then @Andre's example you could just run it from console and see the error that way without modifying any code.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #3 - Posted 2014-01-05 18:45:40 »

I have run it trough the console on windows, but i get no error showing up. I have tried added the try and catch on several different positions in the code, invoking the switch to GameScreen, and on the constructor in GameScreen. I also tried adding a few System.out.printlns here and there and none of them showed up.
Offline Andre Lopes
« Reply #4 - Posted 2014-01-05 19:46:50 »

Take a screenshot of your .jar with the libraries folder location and the eclipse export settings.

Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #5 - Posted 2014-01-05 20:21:42 »

Here is a screenshot proving that the libgdx stuff and others are in there, the folder is filled with classlibraries and so on.
https://www.dropbox.com/s/cfnfstuf7fv2w12/rarcomfolder.png

And here is a screenshot of the settings.
https://www.dropbox.com/s/ctf333pf6by7hlm/settings.png

 I have tried both extracting and packaging the libraries, nothing works. If it would have been a libraries problem, the first screens wouldnt work either, since they use tween stuff and the libraries associated with that. The only things i have added since friday are more images, which i have checked, they are there in the jar. Some code, and a new death/highscore screen. The code are simple loops to print the images up.

*edit* I tried to comment out everything but the camera and map generation from the gamescreen and it still doesnt run.
Offline Andre Lopes
« Reply #6 - Posted 2014-01-05 20:25:17 »

Here is a screenshot proving that the libgdx stuff and others are in there, the folder is filled with classlibraries and so on.
https://www.dropbox.com/s/cfnfstuf7fv2w12/rarcomfolder.png

And here is a screenshot of the settings.
https://www.dropbox.com/s/ctf333pf6by7hlm/settings.png

 I have tried both extracting and packaging the libraries, nothing works. If it would have been a libraries problem, the first screens wouldnt work either, since they use tween stuff and the libraries associated with that. The only things i have added since friday are more images, which i have checked, they are there in the jar. Some code, and a new death/highscore screen. The code are simple loops to print the images up.

*edit* I tried to comment out everything but the camera and map generation from the gamescreen and it still doesnt run.

try something for me, might be a long shot but ...

https://www.dropbox.com/s/ctf333pf6by7hlm/settings.png

(x) copy required .. sub-folder bla bla bla.

copy main code here as well.
Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #7 - Posted 2014-01-05 20:40:57 »

https://www.dropbox.com/s/zgxk0ol9ohbdv18/folder.png


What main code are you after? just main class?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
package com.sabo.zombies;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

public class Main {
   public static void main(String[] args) {
     
   
      LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
      cfg.title = "Zombies";
      cfg.useGL20 = true;
      cfg.width = 480;
      cfg.height = 320;
       cfg.resizable = false;
     
      new LwjglApplication(new Zombies(), cfg);
   
}
}
Offline Andre Lopes
« Reply #8 - Posted 2014-01-05 20:50:53 »

https://www.dropbox.com/s/zgxk0ol9ohbdv18/folder.png


What main code are you after? just main class?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
package com.sabo.zombies;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

public class Main {
   public static void main(String[] args) {
     
   
      LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
      cfg.title = "Zombies";
      cfg.useGL20 = true;
      cfg.width = 480;
      cfg.height = 320;
       cfg.resizable = false;
     
      new LwjglApplication(new Zombies(), cfg);
   
}
}



the window just closes when i have gone trough a few screens


Test :
Comment everything in dispose method or that calls dispose();

Are you using assetManager or Atlas ?
Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #9 - Posted 2014-01-05 21:00:35 »

There is nothing in the GameScreen dispose, the only one that got is the MainMenu screen, which also uses an atlas. But nothing else does(neither do they use and atlas), havent gotten into learning that or the assetmanager yet. Anyways, i have skipped all the screens in front of gamescreen and go directly to the gamescreen when the game launches, and the game crashes. So i dont think that has anything to do with it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Andre Lopes
« Reply #10 - Posted 2014-01-05 21:08:25 »

It crashes how? What you have in show() method or hide()

Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #11 - Posted 2014-01-05 21:16:14 »

I don't know how it crashes, it doesn't give me any error.

Show:
1  
2  
3  
4  
5  
6  
7  
      map = new TmxMapLoader().load("maps/untitled.tmx");
      mapRender = new OrthogonalTiledMapRenderer(map);
      camera = new OrthographicCamera(width, height);
      player = new Player(new Vector2(width / 2, height /2), 60, (TiledMapTileLayer) map.getLayers().get(0), 4, bullets, camera);
      bullets = new ArrayList<Bullet>();
      enemies = new ArrayList<Monster>();
      Gdx.input.setInputProcessor(player);

There is nothing new in there, i don't remember the last time i edited anything in show().


Hide has nothing, i even commented out the call to the empty dispose. Resize is just changing the viewport and such, but isnt called since the window isnt resizable anymore.(i tried making it resizable again, but it crashes anyway.)
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #12 - Posted 2014-01-05 21:25:11 »

Can you try running it on a different computer?

Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #13 - Posted 2014-01-05 21:29:29 »

I have tried on my laptop, no luck.
Works in eclipse, but not exported jar. :/
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #14 - Posted 2014-01-05 21:32:31 »

The only conceivable reason why it doesn't work is because your resources are messing up. I've barely used LibGDX though. Are LibGDX games just export and run? Or do you have to run them through JarSplicer first?

Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #15 - Posted 2014-01-05 21:53:06 »

I am working my way slowly trough the game uncommenting stuff as i extract the game from a working state to a crashing state. I think its somewhere in the entity / player class. But since i dont get an error i have no idea.


Yea, just export and run. The assets are there in the .jar file, so i am baffled.
Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #16 - Posted 2014-01-05 22:31:28 »

Ok.... i am a little pissed now.

Turns out Eclipse is not case sensitive when it comes to file names, whilst the java run outside Eclipse is....
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #17 - Posted 2014-01-05 23:05:59 »

Why would you ever not type the name exactly the same anyway? That's just silly and isn't the JVM's fault nor is it Eclipse's either.

Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #18 - Posted 2014-01-05 23:50:29 »

I always type the names the same way, but for some reason this time it was different.

And how is it not eclipses fault if it doesn't pay attention to such an obvious error?
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #19 - Posted 2014-01-05 23:54:19 »

Compilers only do what you tell it to do. If you get in the habit of not typing everything exactly correct, then how can you expect the program to know what to do? Eclipse is actually creating bad habits, yes, but only if you let yourself slip into them.

Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #20 - Posted 2014-01-05 23:56:57 »

If the compiler does not show that there is something wrong, even compiles and runs everything just fine, even though if there is an error that will prevent it from running, has an huge error in it.
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #21 - Posted 2014-01-06 02:56:21 »

If there is not an error printing out there most likely is not an error occurring, otherwise something would be printed out. One of the harder things in programming (sometimes easiest thing) is to accept that you have done something wrong and it is not a bug in the software you are using, but rather in the code you wrote.

Offline Andre Lopes
« Reply #22 - Posted 2014-01-06 03:46:59 »

I had some error like that.
Windows will load files for you without case-sensitive.
Android wont.

So i was having problems and i didnt know why. Then i noticed...
Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #23 - Posted 2014-01-06 08:40:35 »

Its a bug in the software if it doesn't tell me that there is an error.
It's eclipse on windows, running a jar on windows. They should give the same errors. If not, Eclipse has given a false compiler that gives people false input.
Offline tom_mai78101
« Reply #24 - Posted 2014-01-06 15:12:17 »

Then report the issue in the bug tracker page.

Wait until they give you a response, and see if you can accept the judgement(s), or continue to provide comments/opinions on it.
Offline Andre Lopes
« Reply #25 - Posted 2014-01-07 03:39:45 »

Its a bug in the software if it doesn't tell me that there is an error.
It's eclipse on windows, running a jar on windows. They should give the same errors. If not, Eclipse has given a false compiler that gives people false input.

Not really.
Netbeans does the same thing.

Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #26 - Posted 2014-01-07 12:32:28 »

If you follow a map(Eclipse), and it creates a bridge where it thinks it should be a bridge, but it is'nt actualy built. So in reality(running the jar) when you come to that place, there is no bridge. That is a fault on the map, not the reader.
Offline StumpyStrust
« Reply #27 - Posted 2014-01-07 12:37:22 »

I bet you somewhere in the documentation Eclipse says it does this. Now it is still the map readers fault for not learning how to use the map.  Pointing

Offline Andre Lopes
« Reply #28 - Posted 2014-01-07 17:51:04 »

If your Program makes so much I/O , imagine if the IDE would keep checking one by one everytime you opened it.
Would take ages, especially if you are , supposedly, making a crysis 3 - Clone, for example.

Cheesy
It doesnt make sense.
Its your responsability for do that. The IDE is to help, not do it for yourself.
Offline Sabomoth

Junior Member


Medals: 1
Exp: 2 years



« Reply #29 - Posted 2014-01-07 19:05:25 »

The IDE isn't supposed to be able to run with a crash in the code. And if the IDE goes around this crash, knowing its there, it should tell about it. It makes total and complete sense, thinking anything else is f*cked up.
Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (14 views)
2014-07-24 01:59:36

Riven (14 views)
2014-07-23 21:16:32

Riven (13 views)
2014-07-23 21:07:15

Riven (15 views)
2014-07-23 20:56:16

ctomni231 (43 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (50 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!