# I can add the tmx and tilesets in a .jar file?

**URL:** <https://discourse.mapeditor.org/t/i-can-add-the-tmx-and-tilesets-in-a-jar-file/915>\
**Category:** Questions\
**Created:** [November 12, 2015, 10:18pm UTC](https://discourse.mapeditor.org/t/i-can-add-the-tmx-and-tilesets-in-a-jar-file/915 "2015-11-12T22:18:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thallysson](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@Thallysson](https://discourse.mapeditor.org/u/Thallysson)\
**Post date:** [November 12, 2015, 10:18pm UTC](https://discourse.mapeditor.org/t/i-can-add-the-tmx-and-tilesets-in-a-jar-file/915/1 "2015-11-12T22:18:28Z")

</div>

I can add the tmx and tilesets in a .jar file?

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [November 14, 2015, 7:39pm UTC](https://discourse.mapeditor.org/t/i-can-add-the-tmx-and-tilesets-in-a-jar-file/915/2 "2015-11-14T19:39:24Z")

</div>

Sure you can add them to a .jar. Whether you can actually load the map from it depends on your map loader. `libtiled-java` currently won’t load such maps because it will look for referenced files outside of the .jar, so if you’re using that you’ll need to make some modifications.

---

<div class="post-metadata">

**Author:** ![Thallysson](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@Thallysson](https://discourse.mapeditor.org/u/Thallysson)\
**Post date:** [November 14, 2015, 9:43pm UTC](https://discourse.mapeditor.org/t/i-can-add-the-tmx-and-tilesets-in-a-jar-file/915/3 "2015-11-14T21:43:51Z")

</div>

Is it just i move the for tmx into the jar, i move the tilesets and change the directory of the same in tmx?

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [November 15, 2015, 1:19pm UTC](https://discourse.mapeditor.org/t/i-can-add-the-tmx-and-tilesets-in-a-jar-file/915/4 "2015-11-15T13:19:52Z")

</div>

No, it’s not just that. As I answered earlier, you’ll need to change the map loading code so that it will actually load things from the .jar file. Java has a [`getResourceAsStream`](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResourceAsStream%28java.lang.String%29) function for this.

---

<div class="post-metadata">

**Author:** ![Thallysson](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@Thallysson](https://discourse.mapeditor.org/u/Thallysson)\
**Post date:** [November 15, 2015, 1:26pm UTC](https://discourse.mapeditor.org/t/i-can-add-the-tmx-and-tilesets-in-a-jar-file/915/5 "2015-11-15T13:26:17Z")

</div>

OK, thank you
