Issue with the Constructor in own JAVA based Libraries

Successfully managed the library template 3.0,2 integration into Eclipse (Win 8.1). Managed to build the example.

But I run in trouble while creating a library on my own.
This "The constructor MYClass(....) is undefined message" issue.

What have to be considered while creating the MyClass.java file. I used the HelloLibrary.java to start with.

As a workaround I again start with the example and step by step I remove code and add my own code (after renaming the necessary parts in the entire template). This seems to be OK, but I did on the first approach, too.

Are there better examples simple enough to get an understanding but with more comples Constructors? Or what is the prerequesite for a well defined Constructor taking more arguments in a class file?

F41

Answers

  • Answer ✓

    It might be a typo above but the class name and constructor name must match exactly

    So if class is called MyClass then the constructor is

    public MyClass() {
      // code for default constructor
    }
    
    public MyClass( ... parameters ...){
      // code for this parameter constructor
    }
    
  • Answer ✓

    I also suggest that you change the first line (ONLY) in the build.xml file

    <project name="Processing Library" default="clean" basedir="../">

    Change the name to something that represents your library. I use Eclipse and have 9 libraries, so it helps me tell the build files apart in the Ant view, like this

    Screen Shot 2017-12-03 at 11.53.08

    If you have the Ant view open you can simply double click on the library build file you want to run. :)

  • Thanks a lot quark. Issue solved and I much appreciate your hint regarding the build.xml.

Sign In or Register to comment.