We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
The example given here is on a Mac, but I don't think it matters much. I have a problem that appeared after exporting my project as an application. Basically, when I use the Processing IDE to run my code, when I call dataPath(), it doesn't return the correct path, ie ".../Processing/MyProject/data/" but instead, I have something like "/Applications/data".
However, after compiling it, I have the correct path, ie: "/.../Processing/MyProject/application.macosx/MyProject.app/Content/Resources/Java/data/"
Anyone knows how I can have the correct path even when running my code with the Processing app?
Thanks.
Best, Diyoyo.
Answers
Actually, it seems to happen only when I put a
static public void main(String args[]){ }
method in my file.
So I guess that's the problem, but I don't know how to solve it, because I need to pass arguments to my application...
Generally, we shouldn't override main(), b/c that's the part which instantiates & runs Processing's own framework (PApplet);
which later on will callback our customized setup() & draw() and the rest of the event functions if present!
Nonetheless, the framework conveniently stores any passed arguments into
args[]
field: ;)Oh, great, thanks a lot :D
Now it works from the command line in MacOS when I type:
open MyProject.app --args myargs
However, I don't know what should be the structure of the command in the cmd.exe in Windows. I have tried
MyProject myargs
but it doesn't work... Should I modify the bat file?