如何离线运行此Applet?

时间:2010-10-27 16:32:30

标签: java debugging applet

我需要这个位于此处的小程序link text(弹出窗口中的相同内容:hxxp://tcip.mste.illinois.edu/applet_popup.php?num = 2)

(请将“hxxp”替换为“http”以访问上述链接)

我已下载(实际上镜像了整个网站:D)所有的罐子和放大器js文件。

其中一个js(tcip.js)描述了将调用哪个applet&哪个类位于特定的jar文件中。

那么,我如何离线执行/运行它?是这样的,我必须在netbeans项目中包含所有jar文件&然后运行它?

因为我是java& amp;的初学者我在学院的电网演示中非常需要这个applet

如果有人能帮我解决这个问题,我将非常感激。

我能够在页面源中获得的一条线是:

edu.uiuc.TCIP.education.summer06.lessons.lesson4.Lesson4Applet
这是什么意思?是否像我下载的所有5-6个jar文件同时运行..然后其中一个名为“lessons”或“lessons_old_naming”的jar文件具有这种结构

edu.uiuc.TCIP.education.summer06.lessons.lesson4.Lesson4Applet

因为这是包结构..?和Lesson4Applet是我想要执行的...?

如何才能让它离线查看/执行..?

非常感谢..如果你们中的任何人能够让它为我工作......对于离线(本地执行的jar)观看。

控制台输出/错误详情:

Java Plug-in 1.6.0_22
Using JRE version 1.6.0_22-b04 Java HotSpot(TM) Client VM
User home directory = C:\Users\~Ultimate~
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


load: class edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet not found.
java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: F:\USB_240910\ht\nw22\nw22\tcip.mste.illinois.edu\edu\uiuc\TCIP\education\summer06\lessons\lesson2\Lesson2Applet.class (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 9 more
Exception: java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet
load: class edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet not found.
java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: F:\USB_240910\ht\nw22\nw22\tcip.mste.illinois.edu\edu\uiuc\TCIP\education\summer06\lessons\lesson2\Lesson2Applet.class (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 9 more
Exception: java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet
load: class edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet not found.
java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: F:\USB_240910\ht\nw22\nw22\tcip.mste.illinois.edu\edu\uiuc\TCIP\education\summer06\lessons\lesson2\Lesson2Applet.class (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 9 more
Exception: java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet
load: class edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet not found.
java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: F:\USB_240910\ht\nw22\nw22\tcip.mste.illinois.edu\edu\uiuc\TCIP\education\summer06\lessons\lesson2\Lesson2Applet.class (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 9 more
Exception: java.lang.ClassNotFoundException: edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet

2 个答案:

答案 0 :(得分:3)

深入研究启动该applet的JS建议相关的applet元素是:

<APPLET name='myApplet' WIDTH = 800 HEIGHT = 600 
        CODE='edu.uiuc.TCIP.education.summer06.lessons.lesson2.Lesson2Applet' 
        ARCHIVE='jfreechart-1.0.10.jar , jcommon-1.0.13.jar , jama-1.0.2.jar, lessons_old_naming.jar , psdataobjects.jar, psdisplayobjects.jar, anl_lpsolver.jar , zebLP.jar'>
</APPLET>

如果您使用该applet元素和代码库http://tcip.mste.illinois.edu/创建HTML,它应该可以正常工作。请注意,一旦applet加载到我的FF中,我只得到一个“黑屏”(耸耸肩)。

BTW - 你是否获得了applet和网站制作者的许可才能使用他们的applet?


顺便说一句 - 我已经测试了这个applet元素并且看到它在本地工作了!


后来:现在我更仔细地看你的问题,我意识到我从来没有真正回答过它,因为我错过了'离线'细节。我的坏!

通过添加codebase属性,我通过允许JRE返回所有资源的原始站点来“欺骗”。 AFAIU这些资源是:

  1. 存档属性中提到的Jars。
  2. 小程序使用的图像。
  3. 这会有点棘手。

    让我们假设您希望HTML(不良)命名为OFFLINE_applet.html,并且您希望所有内容都位于powergrid目录中。在这种情况下,结构将是......

    • 能量栅格
      • OFFLINE_applet.html
      • jfreechart的-1.0.10.jar
      • jcommon-1.0.13.jar
      • JAMA-1.0.2.jar
      • lessons_old_naming.jar
      • psdataobjects.jar
      • psdisplayobjects.jar
      • anl_lpsolver.jar
      • zebLP.jar
      • applet_images

    实际上,并非所有applet_images中的图像都是必需的。这个小程序只使用了大约20个AFAIR,但是下载它们并且应该可以正常工作。

    当然,请删除“codebase”属性,否则JRE仍会尝试返回http://tcip.mste.illinois.edu/网站获取资源!

    测试并回复我。

答案 1 :(得分:0)

将php页面的结果保存为html页面并在任何浏览器中打开它。 applet不需要服务器连接,然后它就可以工作。