我不是很熟悉Java或Java小程序,但我必須解決這個問題。如何調試java小程序
自從JRE 7 Update 21開始,applet就會在所有瀏覽器中引發eceptions。
我需要調試應用程序,因爲錯誤沒有給出任何線索(應用程序正在運行了多年,現在,它的客戶不能使用它了之後最新的JRE更新)。
所以這個applet被用作.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
然後我試圖在調試選項連接到使用「遠程Java應用程序」,在日食通過連接到的locahost:5005,但我得到拒絕連接。
請有人能指出我的解決方案 - 我如何在Eclipse中進行調試?
也許你有同樣的問題:http://stackoverflow.com/questions/17786669/java-1-7-0-u25-applet-debugging-with-eclipse/17941467#17941467 – Oli 2013-07-30 08:11:20