# How to share files between sketches?

**URL:** <https://discourse.processing.org/t/how-to-share-files-between-sketches/10660>\
**Category:** Processing\
**Created:** [April 26, 2019, 1:09pm UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660 "2019-04-26T13:09:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![securet](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@securet](https://discourse.processing.org/u/securet)\
**Post date:** [April 26, 2019, 1:09pm UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660/1 "2019-04-26T13:09:34Z")

</div>

how to share files between sketches?  
Like I want to have a class available in two of my sketches and don’t want to copy paste it all the time.

---

<div class="post-metadata">

**Author:** ![humayung](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/humayung/32/6089_2.png) [@humayung](https://discourse.processing.org/u/humayung)\
**Post date:** [April 26, 2019, 5:00pm UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660/2 "2019-04-26T17:00:05Z")

</div>

hmm, can you explain more?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 26, 2019, 5:04pm UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660/3 "2019-04-26T17:04:23Z")

</div>

Let‘s say in folder A is a pde with some cool classes

he wants to use that pde in 2 different sketches being in Folders B and C

---

<div class="post-metadata">

**Author:** ![DongKingKong0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dongkingkong0/32/960_2.png) [@DongKingKong0](https://discourse.processing.org/u/DongKingKong0)\
**Post date:** [April 26, 2019, 5:14pm UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660/4 "2019-04-26T17:14:22Z")

</div>

If you’re going to edit something in your class, the best way to do this would probably be a library.  
If you have the same file in multiple sketches and don’t want to edit them at some point, the easiest way would probably be copy & pasting your `.pde` file into a different sketch folder.  
Depending on your operating system, there might be some tools that do this work for you, but since Processing only has a really basic IDE, there’s no function to do this.

---

<div class="post-metadata">

**Author:** ![humayung](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/humayung/32/6089_2.png) [@humayung](https://discourse.processing.org/u/humayung)\
**Post date:** [April 26, 2019, 5:43pm UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660/5 "2019-04-26T17:43:52Z")

</div>

as i know, you can refer to the same file using absolute path like this:

`img = loadImage("/home/humayung/Dropbox/test.png");`  
it worked on my linux.  
just copy the full path to the file. do the same to the different sketches on different directories you wanna shared. tell me is it working

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 26, 2019, 6:07pm UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660/6 "2019-04-26T18:07:34Z")

</div>

it’s true that this works for images and fonts and svg and stuff (assets)

but OP (original poster) was wanting to have a class available in two of his sketches

so he’s talking about pde, not images.

**Remark**

The idea of a shared class is interesting though.

Of course library is the answer, but it’s hard to make a lib.

Below this advanced level:

OP [securet](https://discourse.processing.org/u/securet) could have one reference folder with a test pde and a pde for the common class.

Now we could have a 2nd sketch (or some OS tool as [DongKingKong0](https://discourse.processing.org/u/DongKingKong0) said) to deploy (copy) the class pde to a couple (30) of folders from a list A.

When we change the class we deploy it again to all 30 folders from the list A.

When we make a new sketch that uses the class, we add its folder to the list A and deploy again.

Nice.

(I copy and paste all the time)

Chrisir

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [April 30, 2019, 2:26am UTC](https://discourse.processing.org/t/how-to-share-files-between-sketches/10660/7 "2019-04-30T02:26:36Z")

</div>

A related approach is compiling to jar, then including that jar in Processing (so that all sketches have access to it) – this is less complicated than making it a full library in Contributions Manager. For recent discussion see:

> [@How to include .pde o .java file with path?](https://discourse.processing.org/t/how-to-include-pde-o-java-file-with-path/10646):
>
> Hi, i have a question… I work in a library for processing over 3 years ago, i named this library “gameLibZero” and this is a library for game programming in processing 3.x on Windows, linux, macosx and Android… my problem starts with the code, the library is a .pde file that I must add to any project where I want to use it. The problem is that I can not leave it in a folder where processing is used without having to copy it to the project folder every time … Is there a way to include a .pde …
