We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have a rather large program that is becoming too difficult to manage in the Processing 2.2.1 IDE. I want to move it over to Eclipse, but I don't understand the mechanics of going from Eclipse to a windows executable file. This is example code .pde from Tablet4 library with the comments removed for space reasons.
import codeanticode.tablet.*;
Tablet tablet;
void setup() {
size(640, 480);
tablet = new Tablet(this);
background(0);
stroke(255);
}
void draw() {
if (mousePressed) {
strokeWeight(30 * tablet.getPressure());
line(pmouseX, pmouseY, mouseX, mouseY);
}
}
To go from Processing to a windows executable is pretty straight forward. You export the application and move the jpen-2-3-64.dll into the same folder as the generated executable and it works fine.
This is the Eclipse version:
import codeanticode.tablet.*;
import processing.core.*;
public class MainApp extends PApplet{
Tablet tablet;
public void setup() {
size(640, 480);
tablet = new Tablet(this);
background(0);
stroke(255);
}
public void draw() {
if (mousePressed) {
strokeWeight(30 * tablet.getPressure());
line(pmouseX, pmouseY, mouseX, mouseY);
}
}
}
With the external libraries added to the build path and the jpen-2-3-64.dll put in the project's library folder, it runs fine from Eclipse. But I cant figure out how to turn it into an executable as was done from the Processing IDE. I can't even get a runnable .jar The project is called BasicPen in Eclipse. In the right context menu I chose Export->Java->Runnable Jar file. In the launch configuration, there is only one choice "Papplet-BasicPen" I choose this and export it to a folder in the root directory. It finishes with warnings.
Exported with compile warnings: BasicPen/src/MainApp.java
duplicate entry: gluegen-rt.dll
duplicate entry: gluegen-rt.dll
duplicate entry: jogl_desktop.dll
duplicate entry: jogl_desktop.dll
duplicate entry: jogl_mobile.dll
duplicate entry: jogl_mobile.dll
duplicate entry: nativewindow_awt.dll
duplicate entry: nativewindow_awt.dll
duplicate entry: nativewindow_win32.dll
duplicate entry: nativewindow_win32.dll
duplicate entry: newt.dll
duplicate entry: newt.dll
Jar export finished with problems. See details for additional information.
Could not find main method from given launch configuration.
I think that last line is the problem. When I try to run the jar, nothing happens and I'm pretty sure its because it can't find "main" What is the proper way to do this? I think if I can get to a runnable .jar I can find a wrapper program to turn that into a windows executable.
Answers
I get it now. An applet doesn't have a main so its impossible to make it an executable from Eclipse.
Do a quick sketch in processing ide, export it and look at the exported app for hints. See if it adds a main to the Java file, or adds something to a manifest file somewhere.
Yes, it has a main which the program I posted above is missing. I have to play with this more because I also need access to the Frame that's created.