### Constructor not found Message

When creating new instances of a Java Class, by using a JavaObject, be strict in definig the correct type of parameter.
If this is not the case, an Error Message "Constructor not found" is shown when executing the API method.
Examples
Create a Rectangle
Create a new instance of a Rectangle with the given position and size.
Rectangle(double x, double y, double width, double height)
Reference: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/shape/Rectangle.html
B4J Code
`Sub CreateRectangle(x As Double, y As Double, w As Double, h As Double, fill As Paint)
Dim jo As JavaObject
' Init a new instance of a rectangle class. Note that all parameters are Double and not int!
jo.InitializeNewInstance("javafx.scene.shape.Rectangle", Array As Object(x,y,w,h))
' Fill the new rectangle with a color
jo.RunMethod("setFill", Array(fill))
' And add the rectangle to the rootnode --- do not forget this else the new rectangle is not visible
Dim n As Node = jo
n.Id = "My Rectangle"
MainForm.RootPane.AddNode(n,x,y,-1,-1)
End Sub`
Rename file
' Rename a file
' The path can contain full and different path, which would be the same as moving a file
' Reference: http://docs.oracle.com/javase/8/docs/api/java/io/File.html
`Sub renameFile(source As String, target As String)
Dim joFileSource As JavaObject
Dim joFileTarget As JavaObject
' Create the file instances for the files (the constructor)
joFileSource.InitializeNewInstance("java.io.File", Array As Object(source))
joFileTarget.InitializeNewInstance("java.io.File", Array As Object(target))
' Rename file to
joFileSource.RunMethod("renameTo", Array As Object(joFileTarget))
End Sub`

Changed: , Category: JavaObject, File: T6C208M1520.htm, ID: 1520