# Including shared pde files across projects

**URL:** <https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701>\
**Category:** Development\
**Created:** [July 12, 2018, 3:49am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701 "2018-07-12T03:49:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)\
**Post date:** [July 12, 2018, 3:49am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/1 "2018-07-12T03:49:48Z")

</div>

Honey gave me an answer to my question [How can I make an include file for my scripts - SOLVED THANKS](https://discourse.processing.org/t/how-can-i-make-an-include-file-for-my-scripts-solved-thanks/1569) which to paraphrase said stick your variables in a file called file.pde in the same directory and it is included automagically. And that works nicely BUT

I want to share my variables between projects, so I thought I could just move the file up a level to the projects directory and that might work, but no I get a message variable cannot be resolved.

So I hunted about looking for an answer and there was a bunch of stuff that talked about tabs and classes and classpath, but none of them seemed to give what I expect is a simple answer.

How can I create a file containing variables and put it somewhere that I can then pull it into my multiple different projects i.e like #include ./somefile.pde

It seems to me that if you can stick a file name.pde in the directory and it gets included automagically there must be a nice straight forward way to stick it somewhere else and pull it in at compile/run time.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 12, 2018, 4:33pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/2 "2018-07-12T16:33:23Z")

</div>

- For “.pde” files, I don’t think it is possible to share them globally for all sketches. 😢
- Processing’s IDE (PDE) offers a way for us to `import` “.jar” libraries into our sketches.
- Therefore, you’re gonna need to create a “.jar” file containing your variables/constants in it.
- It’s a hard long road. 1st we start w/ a “.java” file, which’s compiled as a “.class”, and then packaged/compressed as a “.jar”.
- And finally we follow the instructions from the wiki below in order to place that “.jar” file in the “sketchFolder/libraries/”, so it can be imported like any regular Processing 3rd-party library:

- [https://GitHub.com/processing/processing/wiki/How-to-Install-a-Contributed-Library](https://GitHub.com/processing/processing/wiki/How-to-Install-a-Contributed-Library)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 12, 2018, 4:46pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/3 "2018-07-12T16:46:06Z")

</div>

As a prelude, create a new sketch w/ its main tab like this:

```auto
/**
 * PaletteJarSketch (v1.1)
 * GoToLoop (2018/Jul/13)
 *
 * https://Discourse.Processing.org/t/
 * including-shared-pde-files-across-projects/1701/3
 */

import malcolm.Palette;
import static malcolm.Palette.*;

background(BLUE);

strokeWeight(3.5);
stroke(RED);
fill(YELLOW);

ellipse(width>>1, height>>1, width>>1, height>>1);

```

See there’s an `import` statement in the “.pde” file:  
`import static malcolm.Palette.*;`

It expects a library which belongs to `package` “malcolm”, and a `class` or an `interface` called Palette.

Now, create a new tab named exactly as “Palette.java”.  
Then copy & paste this file below there:

```auto
package malcolm;

public interface Palette {
  int
    WHITE = -1, 
    BLACK = 0xff000000, 
    RED = 0xffFF0000, 
    GREEN = 0xff008000, 
    BLUE = 0xff0000FF, 
    YELLOW = 0xffFFFF00, 
    MAGENTA = 0xffFF00FF,
    CYAN = 0xff00FFFF;
}

```

The final product is to turn that “.java” file into a “.jar” 1.

You’re gonna need to search on the Internet on how to compile it w/ `javac`, and then package it w/ `jar`.

Good luck! 😉

---

<div class="post-metadata">

**Author:** ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)\
**Post date:** [July 12, 2018, 9:27pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/4 "2018-07-12T21:27:44Z")

</div>

Thanks so much.

I may have actually seen the link you provided but had not thought it was the answer I wanted. I shall just have to learn to make a jar, I think I will call it vegemite, salty, evidently hard to get used to for some, yet a staple in my daily diet.

Cheers

---

<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:** [July 13, 2018, 2:17am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/5 "2018-07-13T02:17:57Z")

</div>

> [@malcolm\_gc](#):
>
> I want to share my variables between projects

The proper way to do this is using a library, as GoToLoop described.

If you want the same pde code included in every **new** pde file, you should consider using the template folder in Processing. If you visit your sketchbook folder, you find the **libraries** folder and also a **templates** folder. Inside this folder, create a folder called **Java** and add a file named `sketch.pde`. Every time you create a new file in the PDE, this file is used as the template. This might be useful to you or it might not.

Kf

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 13, 2018, 2:20am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/6 "2018-07-13T02:20:48Z")

</div>

> [@kfrajer](#):
>
> … you should consider using the template folder in Processing.

Funny thing I use the PDE’s template feature for both Java & Python modes; and I’ve completely forgot that it could also be applied to what @malcolm_gc is asking here! 🙃

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 13, 2018, 2:23am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/7 "2018-07-13T02:23:57Z")

</div>

> [@kfrajer](#):
>
> … you find the library folder and also a template folder.

Actually “libraries/” & “templates/” subfolders inside our sketchbook folder. 😉

---

<div class="post-metadata">

**Author:** ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)\
**Post date:** [July 13, 2018, 4:59am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/8 "2018-07-13T04:59:12Z")

</div>

Thanks to the responders ! ! !

kfrajer suggests using the template folder and sketch.pde , useful info, but not exactly what I am after I created the template/java/sketch/pde and yes when in Processing you select File New you get a new file with the content of sketch.pde. Problem is if I change sketch.pde that will not ripple down to other older projects.

It seems to me that the suggestion by GoToLoop is what I am after a library that I can call from any project. If I can get ever get it working

I followed GoToLoop instructions to the best of my ability and created project/malcolm/malcolm.pde and project/malcolm/Palette.java from a cmd shell I then compiled it

Project/malcolm/malcolm.pde

```
import static malcolm.Palette.*;

background(BLUE);

strokeWeight(3.5);
stroke(RED);
fill(YELLOW);

ellipse(width>>1, height>>1, width>>1, height>>1);

```

Project/malcolm/Pallete.java

package malcolm;

```
public interface Palette {
  int
	WHITE = -1, 
	BLACK = 0xff000000, 
	RED = 0xffFF0000, 
	GREEN = 0xff008000, 
	BLUE = 0xff0000FF, 
	YELLOW = 0xffFFFF00, 
	MAGENTA = 0xffFF00FF;
}

```

> myjavapath/javac Palette.java – which gave me a Palette.class

manifest.txt  
Main-Class: malcolm

> myjavapath/jar cfm malcolm.jar manifest.txt Palette.class – which created malcolm.jar

I got the information about the manifest.txt from youtube which told me how to run javac and jar If I leave the f option out to not use a manifest I get compile errors

I was not sure whether Main-Class: should be Malcolm or Palette tried both later errors are the same regardless

so anyway I now have a malcolm.jar

> jar" tf ./malcolm.jar lists the contents of the file  
> META-INF/  
> META-INF/MANIFEST.MF  
> Palette.class

so anyway stuck the malcolm.jar into Processing\libraries and run Processing project\malcolm\malcolm.pde

i get a box with a circle - which is what malcolm.pde is supposed to do BUT

Processing says No library found for malcolm.Palette

Some more reading I came across [Java - Packages](https://www.tutorialspoint.com/java/java_packages.htm) it suggests that $CLASSPATH might be an issue , i didnt have a CLASSPATH so I created one

C:\Users\mnmmc\Documents\Processing\libraries\>SET $CLASSPATH  
$CLASSPATH = C:\Users\mnmmc\Documents\Processing\libraries

Unfortunately that didnt fix it - I guess that may not be needed in Processing

The preferences in Processing indicate a path to my Project directory and my library malcolm.jar is in the Project/libraries directory

So I can create jar file but I am still missing something, the naming is wrong or there is some path I haven’t set or I am just not holding my tounge between my teeth correctly.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 13, 2018, 6:39am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/9 "2018-07-13T06:39:42Z")

</div>

I’ve revisited what I did to create a “.class” file and package it as a “.jar” file. Here comes: 😬

- Create a folder for the project: “Palette/”
- Given file “Palette.java” belongs to `package malcolm;`, let’s create a subfolder w/ that same name for it: “malcolm/”
- Place file “Palette.java” inside subfolder “malcolm/”.
- Open the shell in that subfolder and type in: `javac *.java`
- It should create a “Palette.class” file.
- Close shell, and go back to the root folder.
- Reopen the shell in the root folder.
- Now type in: `jar cf Palette.jar *`
- Use 7-zip or some other compress utility to check the content of the “Palette.jar” file.
- We should see 2 folders there: “malcolm/” & “META-INF/”.
- Inside “malcolm/”, we should see: “Palette.class” & “Palette.java”
- And inside “META-INF/”, we should see: “MANIFEST.MF”
- For a quick test, drag in the “Palette.jar” file into the PDE w/ the test sketch I’ve posted.
- The “Palette.jar” should automatically go into the sketch’s subfolder “code/”.
- Run the sketch. It should see & use the “.jar” file via `import static malcolm.Palette.*;`
- Now that the test run had worked, you should follow the wiki in order to make the “Palette.jar” file available for all sketches as a 3rd-party library: 😇  
[https://GitHub.com/processing/processing/wiki/How-to-Install-a-Contributed-Library](https://GitHub.com/processing/processing/wiki/How-to-Install-a-Contributed-Library)

---

<div class="post-metadata">

**Author:** ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)\
**Post date:** [July 13, 2018, 6:52am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/10 "2018-07-13T06:52:58Z")

</div>

wow and on the seventh day !

All this for RED WHITE and BLUE !!!

I do appreciate very much the response and will give it a go tomorrow .

Obrigado

---

<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:** [July 13, 2018, 5:51pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/11 "2018-07-13T17:51:36Z")

</div>

> [@GoToLoop](#):
>
> - Create a folder for the project: “Palette/”
> - Given file “Palette.java” belongs to `package malcolm;` , let’s create a subfolder w/ that same name for it: “malcolm/”
> - Place file “Palette.java” inside subfolder “malcolm/”.
> - Open the shell in that subfolder and type in: `javac *`

@GoToLoop It is not clear what is the relationship between malcolm and Pallete folders. Can you clarify in your post plz? Would it follow `malcolm.Palette.*` scheme? The package name in the java file should be `package malcolm.Palette;` ?

Kf

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 13, 2018, 6:21pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/12 "2018-07-13T18:21:44Z")

</div>

This is what I’ve stated: 👨‍🏫

> Given file “Palette.java” belongs to `package malcolm;`, let’s create a subfolder w/ that same name for it: “malcolm/”

Keyword `package` determines the folder a particular “.java” (and its corresponding “.class”) file belongs to. 🤓

At least that’s what I’ve concluded when I tried to create a “.jar” file for Processing the 1s time.  
I still can be wrong about it! 🙄

This is the “.java” file in my 1st attempt: 😀

> <https://github.com/GoToLoop/command/blob/patch-1/src/deadpixel/command/Command.java>

Notice its `package` statement: `package deadpixel.command;`

The 1st “.jar” file I’ve generated outta it didn’t work though. 😢

Only when I’ve placed the compiled “Command.class” file into the folder path: “deadpixel/command/”, matching the “Command.java”'s `package deadpixel.command;`, the “.jar” output file was accepted by the PDE inside the “code/” subfolder. 😮

Here’s the “.jar” file btW: 🤑

> <https://github.com/GoToLoop/command/tree/patch-1/src/deadpixel/command>
>
> //github.com/GoToLoop/command/tree/patch-1/src/deadpixel/command

Maybe it was just a superstition I’ve got from my 1st experience on it. 😬  
It’d be nice if some1 else would confirm that w/ more tests. 🤪

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 13, 2018, 6:33pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/13 "2018-07-13T18:33:06Z")

</div>

> [@kfrajer](#):
>
> It is not clear what is the relationship between malcolm and Pallete folders. Can you clarify in your post plz? Would it follow `malcolm.Palette.*` scheme?

After my 1st explanation, every1 can see now the whole setup depends solely on the `package` statement, not the rest of the file. 🧐

The only thing the `interface` Palette adds to the “demands” is that b/c it is `public`, the “.java” filename must match the name of whatever top `interface` or `class` was declared as `public`. 😳

Therefore only 1 top, either a `class` or an `interface`, can be declared as `public` inside a “.java” file AFAIK. 😶

They might have changed those limitations on recent Java versions. Not sure. 😵

---

<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:** [July 13, 2018, 6:38pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/14 "2018-07-13T18:38:58Z")

</div>

Ok I have to change the name of the classes for this demo, but this is what I have:

```nohighlight
C:\Users\C\Documents\Processing\CMsketches\customLibrary\customLibrary>jar tf malcolm2.jar
META-INF/
META-INF/MANIFEST.MF
malcolm2/
malcolm2/Gener.class
malcolm2/Gener.java
malcolm2/GenerUp/
malcolm2/GenerUp/GenerUp.class
malcolm2/GenerUp/GenerUp.java
malcolm2/GenerUp2/
malcolm2/GenerUp2/GenerUp2.class
malcolm2/GenerUp2/GenerUp2.java
malcolm2/Pallete/
malcolm2/Pallete/Pallete.class
malcolm2/Pallete/Pallete.java

```

Each class generated individually at their own root folder. Notice for this test you have to stick `public` everywhere. Now this is what I have in each corresponding file:

- Pallete.java: `package malcolm;`
- GenerUp.java: `package malcolm;`
- GenerUp2.java: `package malcolm.GenerUp2.*;`

To build the jar : `jar cf malcolm.jar malcolm`. Placed the jar in the code folder. Now the mcve:

```java
import malcolm2.*;
//import malcolm2.GenerUp.*; <----Not valis as it is not defined anywhere... expected
import malcolm2.GenerUp2.*;

import malcolm2.*;
import malcolm2.GenerUp2.*;

void setup() {
  Gener x=new Gener();
  println(x.val1000); //<----WORKS

  ////GenerUp y=new GenerUp(); <----Unaccessible/Non-existent
  ////println(y.val3000);

  GenerUp2 z=new GenerUp2();
  println(z.val5000); //<----WORKS
}

```

Notice each class has two fields defined, unique to each class. However, I tried testing your interface implementation and it didn’t work.

Kf

---

<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:** [July 13, 2018, 7:48pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/15 "2018-07-13T19:48:34Z")

</div>

Ok so there are some interesting things. if you load your jar file inside your sketch aka inside the code folder, then you do not need to state the `import` statement. You will be able to use it at your leisure. Notice, as dealing with any interface, one needs to use `Pallete.RED` as `RED` will not work.

Now, if you move this library to the Processing’s libraries folder like this:

`yourSketchFolder/Libraries/malcolm/Library/malcolm.jar`

Notice: I am in Win10 OS. Folder names is case sensitive in other OSes.

Then you need to include at the top of your sketch `import malcolm.*;` OR `import malcolm.Pallete;`, the last one is preferred. Notice you don’t need the static modifier for the import.

Notice this layout: `yurSketchFolder/malcolm/Pallete.java` and the first line in your java: `package malcolm;`

Another scenario:  
Notice this layout: `yurSketchFolder/malcolm/Pallete/Pallete.java` and the first line in your java should be: `package malcolm.Pallete;`

When you create the jar via “`jar cf malcolm.jar malcolm`”, the last term indicates the folder to attach to the jar. This will also attach any other subfolders and their contents. So this jar cmd would work for either scenarios above. Notice the last term is the folder name and it does **not** have any slash attach to it (backlash for Windows users).

Kf

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 13, 2018, 11:24pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/16 "2018-07-13T23:24:56Z")

</div>

Due to many conflicting instructions so far, I’ve felt I needed to create a repo just to demo more clearly my own step-by-step howto that I’ve already posted here in this forum thread: 🤠

> **[GoToLoop/Processing\_Jar\_Creation](https://github.com/GoToLoop/Processing_Jar_Creation)**
>
> Example for compiling a ".java" file and package it as a ".jar" for Processing. - GoToLoop/Processing\_Jar\_Creation

There are 2 main folders in that repo: 🧐

1. [“PaletteJarCreationFolder/”](https://github.com/GoToLoop/Processing_Jar_Creation/tree/master/PaletteJarCreationFolder): where the whole processing of creating the “.jar” file takes place.
2. [“PaletteJarSketch/”](https://github.com/GoToLoop/Processing_Jar_Creation/tree/master/PaletteJarSketch): The “.pde” test sketch which uses the “.jar” file created at “PaletteJarCreationFolder/” placed in its subfolder “code/”.

Within “PaletteJarCreationFolder/” we can spot the 2 “.bat” files “Part1.CreateClassFile.bat” & “Part2.CreateJarFile.bat” which contain the command lines I type in to create “Palette.class” & “Palette.jar” respectively: 🕵️‍♂️

1. [“Part1.CreateClassFile.bat”](https://github.com/GoToLoop/Processing_Jar_Creation/blob/master/PaletteJarCreationFolder/malcolm/Part1.CreateClassFile.bat): `javac *.java`
2. [“Part2.CreateJarFile.bat”](https://github.com/GoToLoop/Processing_Jar_Creation/blob/master/PaletteJarCreationFolder/Part2.CreateJarFile.bat): `jar cf Palette.jar *`

Hope it’s now very clear on how I did it and you can mime it if you wish. 😇

---

<div class="post-metadata">

**Author:** ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)\
**Post date:** [July 14, 2018, 6:34am UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/17 "2018-07-14T06:34:12Z")

</div>

Again thank you both for your time.

I spent some quite a bit of time trying to make this work trying this that without much success. Most recently I saw GoToLoop had provide some new files , thank you for that.

kfajer indictes a number of different places and options for the library  
tried putting the jar in libraries/Malcolm/library (libraries)  
tried putting the jar in Processing/libraries  
tried putting the jar in Processing/libraries/Palette/library  
tried putting the jar in the project/Palette.JarSketch

I can create the java file with the files provided by GoToLoop run the batch files and create the class and jar files but cannot get the program to link (is that the correct term???) to the jar.

If the Palette.java file is placed in the same directory as the pde the program runs and creates output.

This is all getting very wordy and I was finding it very confusing so I have created a pdf of where we are at if you would kindly have a look, the diagram attempts to show that the PaletteJarSketch.pde runs and produces output when Palette.java is in the same directory but when Palette.java is not available Processing is unable to find the jar file.

15 Jul modified jpg

 ![javaclass](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/250ab3f132b57f89895d59ff5220a8091ac2f832.jpg)

---

<div class="post-metadata">

**Author:** ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)\
**Post date:** [July 14, 2018, 9:51pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/18 "2018-07-14T21:51:20Z")

</div>

It seemed to me that the jar file should be named malcolm as the pde imports malcolm.Palette, had this vague idea that the jar should have the same name as the package  
so I changed the second bat to create malcolm.jar , that worked ok , well it didn’t complain, stuck it in libraries/malcolm/library and restarted Processing, crossed my fingers and groaned, didn’t work ! ! This is so painful!!

---

<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:** [July 14, 2018, 10:16pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/19 "2018-07-14T22:16:48Z")

</div>

For your library folder, then do in a cmd window `tree /a /f` and post here. Also, post the package line that you are using and the jar command to pack your library. This is what I did in my prev post. I am asking only for the library. Do not include anything relate to your pde that you are using to import this lib of yours.

Kf

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 14, 2018, 11:39pm UTC](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701/20 "2018-07-14T23:39:49Z")

</div>

> [@malcolm\_gc](#):
>
> … had this vague idea that the “.jar” should have the same name as the `package`…

Not according to the article for installing libraries in Processing: ⛔

- [How to Install a Contributed Library · processing/processing Wiki · GitHub](https://GitHub.com/processing/processing/wiki/How-to-Install-a-Contributed-Library)

> The top folder of a library must have the same name as the .jar file located inside a library’s library folder (minus the .jar extension):

Therefore, we’re free to choose whatever name to the “.jar” file, as long as we use that same name for its top folder. 🧐

My “.jar” file was named as: “Palette.jar”. So in order to integrate it to the PDE, I’ve gotta name its top folder inside sketchbook’s “libraries/” folder as “Palette/”: 📁

```auto
 +---libraries
| \---Palette
| \---library
| Palette.jar

```

However, after I’ve completed the “.jar” integration into the PDE, when running the “PaletteJarSketch.pde” w/o the “Palette.jar” inside its subfolder “code/”, the statement `import static malcolm.Palette.*;` didn’t work! 🤕

I had to use a regular `import` before being able to use the `import static`: 🤪

```auto
import malcolm.Palette;
import static malcolm.Palette.*;

```

I’ve updated my “Processing\_Jar\_Creation” repo to include this extra `import` statement already. 😸

And even included the PDE’s “.jar” integration there too: 🕶

> **[GitHub - GoToLoop/Processing\_Jar\_Creation: Example for compiling a ".java"...](https://github.com/GoToLoop/Processing_Jar_Creation)**
>
> Example for compiling a ".java" file and package it as a ".jar" for Processing. - GitHub - GoToLoop/Processing\_Jar\_Creation: Example for compiling a ".java" file and p...

[Next page](https://discourse.processing.org/t/including-shared-pde-files-across-projects/1701.md?page=2)
