Could not run the sketch

Could not run the sketch.

Usage: PApplet [options] [sketch args]
See the Javadoc for PApplet for an explanation.
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help ? Troubleshooting.

My code shouldn’t have any errors and I opened a blank sketch and it ran fine. What’s up? Through my bit of testing it seems to work fine when I comment out the main() in my class. More testing, so can I not have a function called main?

1 Like

Short answer is no. Theoretically we can, but w/ consequences. :fearful:
Notice that a “.pde” file is almost, but not as the same thing as a “.java” file. :coffee:

1 Like

This post explains how a simple pde sketch is secretly transformed into the standard Java code by the PDE(Processing Development Environment). I hope this clarifies why you cannot have a main() in your sketch unless you take certain steps.


1 Like

@kfrajer @GoToLoop Ok thanks