0
我使用Oracle的deployJava.js在我的網站上啓動了一個Java小程序。捕捉異常的web啓動Java小程序
var attributes = { id:'applet',
code:'dummy.Applet.class',
archive: contextPath + '/jar/JAR_NAME.jar',
width:1,
height:1
} ;
var parameters = {jnlp_href: 'Applet.jnlp',
baseUrlParam: baseUrl,
serverConnectionType: 'REST',
java_status_events: 'true'
} ;
deployJava.runApplet(attributes, parameters, '1.6');
的問題是,如果我從JavaScript調用Java函數和小程序拋出RuntimeException,我不能從Javascript一個try-catch趕上這一點。我每次只捕獲「未捕獲的錯誤:NPObject上的錯誤調用方法」。錯誤。
例如:
我調用這個函數在javascript:
function getConfirmation(){
applet.confirmation()
}
,則小程序拋出ApplicationBaseException沒有try-catch塊,我可以看到兩個錯誤:
Uncaught Error: dummy.ApplicationBaseException toperson.js:78
getConfirmation toperson.js:78
(anonymous function) toperson.js:53
b.event.dispatch jquery-1.9.1.min.js:3
v.handle jquery-1.9.1.min.js:3
Uncaught Error: Error calling method on NPObject.
getConfirmation
(anonymous function) toperson.js:53
b.event.dispatch jquery-1.9.1.min.js:3
v.handle jquery-1.9.1.min.js:3
但是使用try-catch塊,我只能捕獲NPObject錯誤。
如何捕獲Java腳本中的其他錯誤?