How does Processing Export work?

What exactly does the Processing’s Export Application do? I’m working on a project that uses Processing in IntelliJ, and I managed to get it building as a jar file. How do I turn it into a exe?

What exactly does the Processing’s Export Application do

  1. Have you tried it? It’s fairly straight forward.
  2. Which operating system are you using?
  3. Please clarify your question: It appears that you want to take an IntelliJ .jar file and use Processing to convert it to an executable. Is this correct?
  1. I have used the Export option in the Processing Editor before, but now I have an IntelliJ Project with multiple files and packages, with the Processing libraries added in as a dependency. I’m not sure how I would convert that back into the editor, especially if I want to use other JAR Libraries.

  2. Windows 10 64-bit Home edition

  3. Yes. It doesn’t necessarily have to convert from JAR though. I have a project that builds to a JAR, and I would like to know how to get it to output an executable like the result of Processing’s export.

Below is boilerplate code for using Processing source code in IntelliJ (available on web). To put the code back into Processing you would take size() from settings() and use setup() and draw() as is. This will work for a very simple app, but not sure how well it would work for a complicated project.

import processing.core.PApplet;

public class Main extends PApplet {
    // The argument passed to main must match the class name
    public static void main(String[] args) {
        PApplet.main("Main");
    }

    // method used only for setting the size of the window
    public void settings(){
        size(400, 400);
    }

    // identical use to setup in Processing IDE except for size()
    public void setup(){
        background(209);
        stroke(0);
        strokeWeight(5);
    }

    // identical use to draw in Processing IDE
    public void draw(){
        circle((float)width/2,(float)height/2,150);
    }
}

Getting an executable jar from IntelliJ is not easy according to this reference: https://lightrun.com/java/how-to-export-a-jar-from-intellij/ . I’m still trying to figure this out myself; wish I could be of more help.

I have a Jar file already, but what I’m looking for is a portable exe file. Something one can just download and run without too much setup.

To get the Jar file you have to export artifacts. https://www.jetbrains.com/idea/guide/tutorials/hello-world/packaging-the-application/

Thank you for the link which shows how to make a .jar file in IntelliJ. There are also instructions in the video about how to make this jar file runnable by double clicking on it. This process is a little complicated but works as advertised. I’m not sure if this executable jar is portable from one system to the next, but it does work on my Mac. I have uploaded the file (1 MB) to DropBox to see if you can run it on your Windows system:https://www.dropbox.com/s/cf8iifesgp6xvld/p5three.jar?dl=0.

Output:

For whatever it’s worth, I also tried exporting a Processing file (3.5.4) to Windows(8) and can see that it exports an executable file (.exe ), not an executable jar file. Rather than switching from one IDE to another it might be simpler just to stick with one, assuming that the output is equal.

Hmm I forgot to say that for the time being, I was able to generate an independent exe by using 7-zip auto extracting archive. It’s for Windows only though.

1 Like