Eclipse exporting as jar (not runnable jar)

This is my first post so please ignore if I should be a bit inapt handling this ^^

So I am currently having a problem exporting a project I did with processing in eclipse.
I imported the core.jar and set up everything properly, so it runs fine when running directly in eclipse and also when exporting it as a runnable jar from that already working preset (the run configuration you select when exporting a runnable jar).

The problem is that I am using an image which must be loaded and I don’t want to have it lying around with the jar which is why I want to pack it with the jar which is impossible when exporting a runnable jar.
The logical solution is to export it as a normal jar and pack it with it, which I did.
Trying to run this jar however results in this exception:

Error: Could not find or load main class com.minesweeper.main.Main

My first guess was that Processing couldn’t find the main class when setting the main class here:


But after some googling around I know find it more likely that it is an error with eclipse exporting it as a jar and not using the correct classpath when calling the main class (or something like that).
This is where I don’t know what to do because all the solutions where using a manual compilation with “javac -cp”.
I never used the command-line compiler so I am stuck here.

What can I do to fix this issue?
Is it related to Processing not finding the compiled class or is it java / eclipse (or package compression)?

1 Like

I’m not sure this is true. I’m pretty sure it’s possible to include images in a runnable jar. What makes you believe it isn’t?

The answer to this question seems to confirm that it’s possible:

If I were you, I’d check out the contents of the .jar file. You can do that using an archive manager like 7zip or whatever comes with your computer, or you can use the jar tf or jar xf commands. Is your main class included in the file?

1 Like

Could be that the exported jar does not have main-class specified in its manifest?