'Jar produced by "Package required libraries into JAR" doesn't work as expected

I've read this and this.

I've done a mvc TicTacToe with Eclipse IDE for Java Developers, Version: 2021-12 M3 (4.22.0 M3). It's a java project (not maven) and it's using JavaSE-17 libs as JRE System Library (installed latest jdk). I'm using swing libs, action listeners, action events ecc ecc. Standard libs you find in your java installation.

Right click on project folder --> Export... --> Runnable jar file --> Extract required libraries into generated JAR

and my program works as expected, like when I run the main class inside Eclipse.

Right click on project folder --> Export... --> Runnable jar file --> Package required libraries into JAR

and my program starts but doesn't work as expected: looks like my AI part doesn't work, some of my little animations don't work too (animations of this kind, this one is working tho) and my new game button has a strange behaviour (it keeps looking pressed until I move the mouse cursor away from its button area).

Now: I've looked inside both jars and the only differences are:

  1. the package one contains a "org" folder the working one hasn't: enter image description here

  2. the MANIFEST.MF file inside the META-INF folder is slighty different. In the package one is:

       Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
       Rsrc-Class-Path: ./
       Rsrc-Main-Class: Main
       Class-Path: .
    

in the working one is:

Manifest-Version: 1.0
Main-Class: Main
Class-Path: .

As far as I'm understading, I'm not using external libs. This is my eclipse project folder:enter image description here

and this is my build path: enter image description here

I don't know what I'm missing... I've included both folders (src and pics... the latter is just a folder with images I correctly see in both exports)

My question: why the jar produced by exporting with Package required libraries into JAR it's not properly working in my case?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source