# Set JFileChooser path to resource

**URL:** <https://forum.universal-robots.com/t/set-jfilechooser-path-to-resource/7541>\
**Category:** Java\
**Created:** [June 3, 2020, 2:19pm UTC](https://forum.universal-robots.com/t/set-jfilechooser-path-to-resource/7541 "2020-06-03T14:19:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon89006500](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@anon89006500](https://forum.universal-robots.com/u/anon89006500)\
**Post date:** [June 3, 2020, 2:19pm UTC](https://forum.universal-robots.com/t/set-jfilechooser-path-to-resource/7541/1 "2020-06-03T14:19:01Z")

</div>

Hi all,

I have a problem when i want to set the current directory to a JFileChooser pointing to my resource. (Program Node Contribution)

I’ve done this, but it doesn’t work:

JFileChooserObj.setCurrentDirectory(this.getClass().getResources("/"));

How can i take the absolute path? or another way to do it?

Thanks!!

---

<div class="post-metadata">

**Author:** ![inu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/inu/32/732_2.png) [@inu](https://forum.universal-robots.com/u/inu)\
**Post date:** [July 9, 2020, 1:51pm UTC](https://forum.universal-robots.com/t/set-jfilechooser-path-to-resource/7541/2 "2020-07-09T13:51:58Z")

</div>

Hello @anon89006500,

There was a similar issue posted a while back, you can check it out [here](https://forum.universal-robots.com/t/loading-script-file-from-the-resources-folder/3391). Let me know if that helps!

---

<div class="post-metadata">

**Author:** ![anon6991142](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@anon6991142](https://forum.universal-robots.com/u/anon6991142)\
**Post date:** [July 22, 2020, 3:35pm UTC](https://forum.universal-robots.com/t/set-jfilechooser-path-to-resource/7541/3 "2020-07-22T15:35:41Z")

</div>

the code you are suggesting worked fine to Read, @inu, but Im having troubles writing to that file.

could you share a snip of code to writing o an existent .txt file on my resource folder?
