# \[SOLVED\] Importing other Processing classes

**URL:** <https://discourse.processing.org/t/solved-importing-other-processing-classes/3708>\
**Category:** Processing\
**Created:** [September 21, 2018, 10:58am UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708 "2018-09-21T10:58:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![delsey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/delsey/32/11380_2.png) [@delsey](https://discourse.processing.org/u/delsey)\
**Post date:** [September 21, 2018, 10:58am UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/1 "2018-09-21T10:58:55Z")

</div>

Hello, this question might seem very blatant but I could’t figure it out by googleing and searching the forums.

I would like to sort the different classes in subfolders of the project (eg. gui, algorithm) and then import them into my main project. I found that theres an “import” but it seems to be for librarys only.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [September 21, 2018, 11:54am UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/2 "2018-09-21T11:54:02Z")

</div>

I don’t believe you can import classes. Instead you could create tabs on your program to store each class.

---

<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:** [September 21, 2018, 12:41pm UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/3 "2018-09-21T12:41:55Z")

</div>

- PDE’s Java Mode recognizes 2 file extensions: “.pde” & “.java”.
- However, we can’t place them in subfolders. They have to be in the root folder.
- All “.pde” files are concatenated together as 1 “.java” file by the PDE’s pre-processor before compilation.
- Therefore, we can’t use `import` for classes/interfaces inside “.pde” files.
- We are allowed to use `import` for classes/interfaces inside “.java” files.
- But it’s completely optional to do so on Processing.

---

<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:** [September 24, 2018, 1:34pm UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/4 "2018-09-24T13:34:04Z")

</div>

It is too bad that you cannot put .pde and .java files in the /code folder, the way that you can add .jar files.

I understand why this is done with .pde files from a UI perspective, as they are created as new tabs, and they need a consistent place to appear (and to be consistently visible to new programmers).

However with .java it seems like being able to treat them as /code resources could sometimes help to keep sketches tidy.

---

<div class="post-metadata">

**Author:** ![delsey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/delsey/32/11380_2.png) [@delsey](https://discourse.processing.org/u/delsey)\
**Post date:** [September 25, 2018, 10:04am UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/5 "2018-09-25T10:04:57Z")

</div>

Yes. Its the first time im actually creating a bigger project with processing and it kinda bothers me that I cannot split the GUI part and the algorithm part into different subfolders. Its not a huge problem, just not the way I’d like it to be 😛

---

<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:** [September 25, 2018, 12:35pm UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/6 "2018-09-25T12:35:34Z")

</div>

Processing’s IDE (PDE) was not targeted for big projects. 😞  
Hence its “.pde” files are simply called sketches. 🥴  
If it’s getting too clunky you should consider moving your project to another more appropriate IDE. 😳

---

<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:** [September 25, 2018, 4:13pm UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/7 "2018-09-25T16:13:58Z")

</div>

@delsey – Two common Java IDEs to use for larger projects are [Eclipse](http://www.eclipse.org/downloads/) and [IntelliJ IDEA](https://www.jetbrains.com/idea/). There is some Processing documentation on working with Eclipse – for example, the [Processing Library Template](https://github.com/processing/processing-library-template).

A downside (if it is a downside for you) is that, if you structure larger projects in a Java IDE, there is no merging multiple .pde files from subfolders (at least, as for as I am aware).

Instead, you will be writing your classes as .java files in Java rather than using Processing syntax (so writing `public` in front of things, no `color` sugar word for int color data, explicitly passing in this rather than having automatic inner classes, et cetera).

---

<div class="post-metadata">

**Author:** ![delsey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/delsey/32/11380_2.png) [@delsey](https://discourse.processing.org/u/delsey)\
**Post date:** [September 25, 2018, 8:46pm UTC](https://discourse.processing.org/t/solved-importing-other-processing-classes/3708/8 "2018-09-25T20:46:40Z")

</div>

I started with java and went to processing because my project is about rendering and moving alot (thousands) of objects which is just pretty diffictult in java. (or at least easier in processing) I really dont care about the structure as long as it works, but i wouldve prefered it to be tidy. Thats not a reason for me to change ide’s mid-development, especially since no one is every going to look at the code of this.
