0

I am working on a project using the Unfolding map library, which requires the application to be a PApplet. However I'm having trouble compiling and running such a program on the command line using javac (it works in Eclipse). Here's what I have right now:

Directory Structure

.
├── build/
├── lib/
│   └── core.jar
├── Makefile
└── src/
    └── unfolding/
        └── Unfolding.java

Makefile

all:
    javac -classpath .:lib/core.jar -sourcepath src -d build src/**/*.java
    cd build
    java -classpath .:../lib/core.jar unfolding.Unfolding

src/unfolding/Unfolding.java

package unfolding;

import processing.core.*;

public class Unfolding extends PApplet {
    public static void main(String[] args) {
        PApplet.main(new String[] { "unfolding.Unfolding" });
    }

    public void setup() {
        size(800, 600, OPENGL);
    }

    public void draw() {
        background(0);
    }
}

When I run the Makefile, I get the following error:

Could not find or load main class unfolding.Unfolding

I've read quite a lot about this (mainly here), but as far as I can tell, I'm doing everything correctly. What else am I missing here?

I'm using Java 1.8 and the core.jar is from Processing 3.

Also note that while my class is called Unfolding, I haven't actually started incorporating the Unfolding library yet, so that is irrelevant to the issue.

Sambit
  • 7,625
  • 7
  • 34
  • 65
vcapra1
  • 1,988
  • 3
  • 26
  • 45

1 Answers1

0

So the issue was I had to run a PApplet and pass the main class as an argument. So like this:

java -classpath .:../lib/core.jar processing.core.PApplet unfolding.Unfolding
vcapra1
  • 1,988
  • 3
  • 26
  • 45