Trouble initiating a Client in Eclipse

Hi all, I am working on a Processing program within Eclipse and I am having issues initiating the Client object. I have properly imported both core.jar and net.jar from the Processing package into my class from these locations:

C:\Program Files\eclipse\processing-2.0.2\core\library C:\Program Files\eclipse\processing-2.0.2\modes\java\libraries\net\library\net.jar

public class Client extends PApplet {
    private static final long serialVersionUID = 0L;

    // Declare a client
    Client client;

    public void setup() {
        size(400, 200);

        // create the client
        client = new Client(this, "127.0.0.1", 8888);
    }
}

The line Eclipse is complaining about (client = new Client(this, "127.0.0.1", 8888) shows an error: the constructor Client(Client, String, int) is undefined.

Per the Client API, there is a constructor that takes those arguments: http://processing.org/reference/libraries/net/Client.html.

I have even tried client = new Client(this, 8888); and Eclipse is still complaining about an error. Can anyone help guide me on how to resolve this? Thanks.

Answers

  • Your class is named Client and processing's 'net' library also has a class named Client. To refer to the processing's class, use processing.net.Client client;. Or you could rename your class to something else like MyClient.

  • Well spotted, Manindra29!

    The error is more common in the PDE (the article Common issues with sketch names (yes, that's a Technical FAQ!) addresses this case) but obviously, it applies to Eclipse as well.

Sign In or Register to comment.