[Solved] .jar in /dist won't run

My project runs as it should when I test it in the SDK, but whenever I build my project and run the .jar in the dist folder something is causing it to appear glitchy and unplayable:

  1. If I run it in full screen the application will start with no errors, but the screen is entirely black - even the FPS and StatsView will not show up.
  2. If I’m not in full screen then the screen doesn’t go black, but the screen spins out of control from any mouse movement.

I think something may be wrong with my build properties or settings? This only happens with this specific project, any new projects I’ve created to test this will allow me to build and run the jar perfectly fine.

I also don’t believe it could be something with my code; I narrowed down the Main class in this project so that it doesn’t actually start my game and runs just like a default, empty project, minus the red cube.

public class Main extends SimpleApplication{
    
  public static Main app;
  public AppController appController;
  private static float width, height;
  private static GraphicsDevice device;
     public static void main(String[] args) {
        
        app = new Main();
        app.setShowSettings(true);
//    app.setDisplayStatView(true);
//     app.setDisplayFps(true);
//    
//    device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
//    width = device.getDisplayMode().getWidth() * .97f;
//    height = device.getDisplayMode().getHeight() * .9f;
//    
//    AppSettings settings = new AppSettings(true);
//    settings.put("Width", ((int)width));
//    settings.put("Height", ((int)height));
//    settings.put("Title", "The Afflicted Forests");
//    settings.put("VSync", true);
//    settings.put("GammaCorrection", true);
//    settings.put("Samples", 8);
//
//    app.setSettings(settings);

    app.start();
    
  }
  
  @Override
  public void simpleInitApp() {
//    appController = new AppController(app, height, width);
//    appController.toMainMenu();
   
  }
  
  private float interval = 5f;
  @Override
  public void simpleUpdate(float tpf) {

    
  }
 
  @Override
   public void stop(){
    //   appController.cleanUp();
       super.stop();
   }
}

I also have built this project with both 3.1 and 3.2 on the same device, I’m not sure if that could be a relevant reason as to where I could have messed up any build settings, but I don’t recall ever changing anything in my project properties aside from the memory usage parameters, and I unfortunately went a long time without testing the jar in my /dist folder so I don’t know when this started happening

1 Like

Maybe try creating a new project and moving the source files over and see if it fails in a similar way.

When I used to use the SDK, recreating the projects seemed like something I had to do every other month or so.

2 Likes

Just to be sure you did “clean & build” at some point instead of just building or running the application?

2 Likes

Yes I made sure I did clean and build

@pspeed I’ll give that a try and see if it still happens.

1 Like

That helped me solve it, thanks!. It looks like I had some referenced libraries that were missing and some duplicate imports in my main project, so I removed all of those and it cleans and builds correctly now

2 Likes