我已經在worklight項目的適配器中編寫了一些java代碼。當I M試圖調用Java方法,我得到一個錯誤說Ecma錯誤:TypeError:無法調用屬性
"responseID":"6","errors": {Ecma Error: TypeError: Cannot call property downloadFile in object JavaPackage java.classes.FileIOPlugin]. It is not a function, it is \"object\".}
我按照下面的鏈接正好規定的程序。 Using Java in Adapters
這是我的項目結構。這個結構有什麼問題,或者我應該添加更多什麼?
我這是如何試圖調用適配器impl.js java的非靜態方法
function downloadFile() {
var fileInstance = new com.worklight.JavaCode.FileIOPlugin();
return
{ result: fileInstance.downloadFile(); };
}
我有一個類似的問題,@christianmenens在[本se post]迴應(http://stackoverflow.com/questions/16614742/ecma-typeerror-calling- java-class-from-worklight-adapter?rq = 1)解決了我的問題 – 2016-08-09 02:53:49
你發現了它!我也必須從服務器中刪除以前的「格式錯誤」的應用程序並重建WAR – 2017-12-01 14:52:30