Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ecma Error: TypeError: Cannot call property

I have written some java code in an adapter in worklight project. when i m trying to call the java method, i am getting an error saying

"responseID":"6","errors": {Ecma Error: TypeError: Cannot call property downloadFile in object JavaPackage java.classes.FileIOPlugin]. It is not a function, it is \"object\".}

I have followed the procedure exactly stated in the following link. Using Java in Adapters

this is my project structure. Is there something wrong with this structure or should i add anything more to this?

enter image description here

This is how i am trying to call the java non-static method in adapter-impl.js

function downloadFile() {
    var fileInstance = new com.worklight.JavaCode.FileIOPlugin();
    return
    {   result: fileInstance.downloadFile();    };

}

like image 362
Ashwini Maddala Avatar asked Apr 05 '13 05:04

Ashwini Maddala


1 Answers

We have identified another possible solution to this.

  • Change Java compiler level to 1.6 as well as default JRE to 1.6:

Compiler levelJRE version

like image 112
Idan Adar Avatar answered Sep 24 '22 18:09

Idan Adar