我对 Java 和 Java 小程序不太熟悉,但我必须解决这个问题。
自 JRE 7 Update 21 以来,小程序在所有浏览器中都引发了异常。
我需要调试该应用程序,因为该错误没有提供任何线索(该应用程序已经运行多年,在最新的 JRE 更新之后客户端无法再使用它)。
因此,小程序在 .NET 应用程序中用作 JAR 文件。它被称为带有一些代码的javascript:
<html>
<head>
<script type="text/javascript">
var i = 0;
var path = "\\\\\\\\reaktorm\\\\Outgoing\\\\test";
var ext = ".tif";
var fullPath = "";
function nextImage() {
if (i==2) {
alert("There is no next image in collection!");
} else {
i++;
displayImage();
}
}
function previousImage() {
if (i<1) {
alert("There is no previous image in collection!");
} else {
i--;
displayImage();
}
}
function displayImage() {
//fullPath= path + (i<10?"0"+i:i) + ext;
fullPath= path + ext;
alert(fullPath);
document.webViewer.display(fullPath);
}
</script>
</head>
<body>
<div style="width:100%; height:100%;">
<applet name="webviewer" archive="..\webviewer.jar" code="my.webviewer.WebViewerApplet.class" width="100%" height="100%">
<param name="java_arguments" value="-Xmx512m">
<param name="image_source" value="C:\test\test.tif">
</applet>
</div>
<form id="testForm" name="testForm" style="display:block">
<input type="button" onClick="previousImage();" value="previous" />
<input type="button" onClick="nextImage();" value="next" />
</form>
</body>
</html>
所以如果我把它放在 html 文件中并在浏览器中打开它,我会得到上面的 RuntimeException。
现在我想调试以找出这个异常的原因。我有 eclipse、源代码和 JAR 导出。
我已经尝试通过启动进行远程调试:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar webviewer.jar
然后我尝试通过连接到 locahost:5005 来使用 Eclipse 中的调试选项下的“远程 Java 应用程序”连接到该应用程序,但我得到连接被拒绝。
请有人指出我的解决方案 - 我如何在 Eclipse 中调试它?