# Eclipse exporting as jar (not runnable jar)

**URL:** <https://discourse.processing.org/t/eclipse-exporting-as-jar-not-runnable-jar/7710>\
**Category:** Processing\
**Created:** [January 21, 2019, 8:57pm UTC](https://discourse.processing.org/t/eclipse-exporting-as-jar-not-runnable-jar/7710 "2019-01-21T20:57:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mastermori](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@Mastermori](https://discourse.processing.org/u/Mastermori)\
**Post date:** [January 21, 2019, 8:57pm UTC](https://discourse.processing.org/t/eclipse-exporting-as-jar-not-runnable-jar/7710/1 "2019-01-21T20:57:30Z")

</div>

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:

```auto
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:

```auto
PApplet.main("com.minesweeper.main.Main");

```

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)?

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [January 22, 2019, 6:02pm UTC](https://discourse.processing.org/t/eclipse-exporting-as-jar-not-runnable-jar/7710/2 "2019-01-22T18:02:44Z")

</div>

> [@Mastermori](#):
>
> I want to pack it with the jar which is impossible when exporting a runnable jar.

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:

> <https://stackoverflow.com/questions/25635636/eclipse-exported-runnable-jar-not-showing-images>

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?

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [January 22, 2019, 7:45pm UTC](https://discourse.processing.org/t/eclipse-exporting-as-jar-not-runnable-jar/7710/3 "2019-01-22T19:45:03Z")

</div>

Could be that the exported jar does not have main-class specified in its manifest? [https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html](https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html)
