B4J Question [SOLVED] JavaObject.RunMethod with numeric params doesn't work

Teech

Member
Licensed User
Longtime User
Hello.
I need to use a third part library but I have an issue using JavaObject.RunMethod with a method who have a parameter "Double".

Making a 'javap -classpath mylib.jar myClass' i have found this methods:
public double setPORTA(double);
public double setINDIRIZZO(java.lang.String);
public double setAZIENDA(java.lang.String);
... and so on
Only setPORTA as a Double parameter.

I have this code
B4X:
    Dim jo As JavaObject
    jo.InitializeNewInstance("myClass",Null)

    'jo.RunMethod("setPORTA",Array(9000)) '<--java.lang.RuntimeException: Method: setPORTA not matched.
    jo.RunMethod("setINDIRIZZO",Array("vps0143.areatecnica.net"))
    jo.RunMethod("setLOGINMXSRV",Array("mexaladm"))
    jo.RunMethod("setPASSWORDMXSRV",Array("SistemaMXI2017"))
    jo.RunMethod("setPASSWORDPASS",Array("MAURIZIO:MAURIZIO"))
    jo.RunMethod("setAZIENDA",Array("ZMB"))
    jo.RunMethod("setTERMINALE",Array("0"))
    jo.RunMethod("setDATAAPTERM",Array("01012019"))
    jo.RunMethod("setPORTA",Array(9000)) '<--java.lang.RuntimeException: Method: setPORTA not matched.

    jo.RunMethod("AVVIACONNESSIONE",Null)
    Log(jo.RunMethod("getERRORE",Null))

Only on the 'setPORTA' Method i found the error "java.lang.RuntimeException: Method: setPORTA not matched.".
I try to move the line up and down and i discovered that other methods are ok.

Could you help me?
Thank you
 

Daestrum

Expert
Licensed User
Longtime User
make it 9000.00 then the compiler knows it's either a double or a float.
If you want to ensure it is a Double then change to 9000.00d
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…