Oracle の deployJava.js を使用して、自分の 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 でこれをキャッチできないことです。私は毎回「Uncaught Error: Error Calling method on NPObject.」のみをキャッチします。エラー。
例えば:
この関数を JavaScript で呼び出します。
function getConfirmation(){
applet.confirmation()
}
次に、アプレットは、try-catch ブロックなしで ApplicationBaseException をスローします。次の 2 つのエラーが表示されます。
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-Script で他のエラーをキャッチするにはどうすればよいですか?