Reputation: 3693
I'd like to use the IntelliJ IDEA IDE to develop some app using Processing 3. How can I do that ?
There are only tutorials on how to use Processing 2, but I think things have changed enough so that those tutorials do not work anymore.
Upvotes: 20
Views: 31500
Reputation: 89
To make it easier to use Processing within an external IDE, I implemented a rudimentary wrapper. This will avoid the necessity to inject the Processing-Object to each created class that want to use Processing methods.
Have a look: Using Processing within external IDE
Upvotes: 0
Reputation: 3645
.jar
files from their official site
Maven
version is outdatedJava
(or Kotlin
) project in IntelliJ
Maven
IntelliJ
, go to File
> Project Structure
CTRL
+ ALT
+ SHIFT
+ S
at the same timeProject Settings
> Libraries
: Click Plus icon
processing-X.Y.Z/core/library
modes
libraryprocessing-X.Y.Z/modes/java/libraries/svg/library
Upvotes: 0
Reputation: 1
Create a maven project in Intellij. In one folder (example "libs") you put all libs which are probably not yet available via mavencentral, but with the help of maven you can handle the installation automatically.
Then inside the pom.xml you add a maven-install-plugin, which will install your libs for you inside your local repository.
<profiles>
<profile>
<id>Assembly Gui</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
<executions>
<execution>
<id>install-controlP5-lib</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
<configuration>
<groupId>sojamo.de</groupId>
<artifactId>controlP5</artifactId>
<version>${controlP5.version}</version>
<packaging>jar</packaging>
<file>${basedir}/libs/controlP5-2.3.0.jar</file>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>install-appleJar-lib</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
<configuration>
<groupId>processing.org</groupId>
<artifactId>appleJar</artifactId>
<version>${appleJar.version}</version>
<packaging>jar</packaging>
<file>${basedir}/libs/apple.jar</file>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
Note that both libs are "installed" during the "validate" phase, so the order is
Because the maven-install-plugin was inserted as a profile (active as default), you can switch it off inside Intellij for saving a bit of time during builds once it runned at least once.
Upvotes: 0
Reputation: 42176
It's hard to answer general "how do I do this" type questions. Stack Overflow is designed more for "I tried X, expected Y, but got Z instead" type questions. You'll have much better luck if you try something out and post an MCVE along with a specific question if you get stuck. You say you think things have changed enough so that those tutorials don't work anymore- could you test that assumption by trying it out?
Because those tutorials will still work. A few things have changed, such as the removal of the ability to embed a PApplet
directly into a Swing
application. But 90% of the rest of the tutorials should work fine.
Step 1: Add the Processing library to your classpath. This includes the core and any JOGL dependencies you need.
Step 2: Create a class that extends PApplet
and add your code there.
Step 3: Call PApplet.main("YourSketchNameHere");
to launch your sketch.
Here is a little example that shows those steps:
import processing.core.PApplet;
public class ProcessingTest extends PApplet{
public void settings(){
size(200, 200);
}
public void draw(){
background(0);
ellipse(mouseX, mouseY, 20, 20);
}
public static void main(String... args){
PApplet.main("ProcessingTest");
}
}
Please try something out and post a specific question if you get stuck. Good luck.
Shameless self-promotion: I wrote a tutorial on using Processing as a Java library, available here.
Upvotes: 39
Reputation: 1132
I up voted Kevin's answer but also went ahead and created a gradle project that you can use with or without an IDE or processing. Git Commit to processing project
Edit doesn't work for video libraries. i tried to get the libraries needed but that is not my best area and have resorted to use P3 for those projects.
Upvotes: 3
Reputation: 23
The easiest way for me is to create a new maven project and add proessing through maven.
After that you create your class that extends PApplet (I named it Main).
In Run > Edit Configuratins add the main class name and the same name for program arguments.
Upvotes: 1