# The file is missing or Inaccessible

**URL:** <https://discourse.processing.org/t/the-file-is-missing-or-inaccessible/2996>\
**Category:** Coding Questions\
**Created:** [August 26, 2018, 5:30pm UTC](https://discourse.processing.org/t/the-file-is-missing-or-inaccessible/2996 "2018-08-26T17:30:06Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [January 17, 2019, 4:09am UTC](https://discourse.processing.org/t/the-file-is-missing-or-inaccessible/2996/22 "2019-01-17T04:09:38Z")

</div>

> [@RecursiveCursive](#):
>
> I want to load the icon from an image that will be bundled inside the compiled jar as a resource and acquiring resource files is not working

@RecursiveCursive Even if `getClass().getResource(...)` returns the full path, `loadImage()` handles only certain cases. First thing is to understand the implementation of `loadImage()`. If you want to inspect this closer, you can have a look at the source code:

> [processing/core/src/processing/core/PApplet.java at master · processing/processing · GitHub](https://github.com/processing/processing/blob/master/core%2Fsrc%2Fprocessing%2Fcore%2FPApplet.java#L5501)

> [processing/core/src/processing/core/PApplet.java at master · processing/processing · GitHub](https://github.com/processing/processing/blob/master/core%2Fsrc%2Fprocessing%2Fcore%2FPApplet.java#L7305)

The first link takes you to the definition of loadImage: In certain cases, it loads the image with _pre-defined methods_ based on the extension. For _png/jpg/unknow_ extensions, it tries first to infer if the image is an url and loads it. Otherwise, it loads the byte stream directly, throwing an error if something goes wrong. But there is no implementation to handle jar files.

In other words, it doesn’t knows how to retrieve data from resource jar files. My suggestion is this. You can try loading the image first using [this post](https://alvinalexander.com/blog/post/java/read-text-file-from-jar-file) and then use the second above to bring it to Processing.

I would like to add that your post is not related to the initial OP statement. You should consider creating a new post next time so the OP does not receive messages that are not related to its initial question.

Kf

[Previous page](https://discourse.processing.org/t/the-file-is-missing-or-inaccessible/2996.md?page=1)
