简体   繁体   English

如何离线运行这个小程序?

[英]How can I run this Applet offline?

I need this applet located here link text (the same in a popup is here: http://tcip.mste.illinois.edu/applet_popup.php?num=2 )我需要这个位于此处的小程序链接文本(在弹出窗口中相同: http : //tcip.mste.illinois.edu/applet_popup.php?num=2

I have downloaded (actually mirrored the whole site :D ) all the jars & the js files.我已经下载(实际上镜像了整个站点 :D )所有的 jars 和 js 文件。

one of the js (tcip.js) describes which applet will be called & from which class located in a particular jar file.其中一个 js (tcip.js) 描述了将调用哪个小程序以及来自位于特定 jar 文件中的哪个类。

So, how can I execute/run it offline?那么,我如何离线执行/运行它? is it like that I have to include all the jar files in a netbeans project and then run it?是不是我必须将所有 jar 文件包含在 netbeans 项目中然后运行它?

As am using Java and I need this applet for a Power Grid presentation in my college.由于我使用 Java,我需要这个小程序在我的大学进行电网演示。

One of the lines which I was able to get in page's source was this:我能够在页面源代码中获得的其中一行是:

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

what does this mean..?这是什么意思..? is it like all the 5-6 jar files which I have download are run simultaneously.. and then one of the jar file named "lessons" or "lessons_old_naming" is having this structure是不是我下载的所有 5-6 个 jar 文件都同时运行..然后名为“lessons”或“lessons_old_naming”的 jar 文件之一具有这种结构

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

as in this is the package structure..?因为这是包结构..? and Lesson4Applet is what I want to get executed..?而 Lesson4Applet 是我想要执行的..?

How can I get it for offline viewing/execution..?我怎样才能离线查看/执行它..?

would appreciate it..if anyone from you could get it working for me..for offline (locally executed jar) viewing.将不胜感激..如果你的任何人都可以让它为我工作..离线(本地执行的jar)查看。

console output/error-details:控制台输出/错误详细信息:

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

Delving into the JS that launches that applet suggests the relevant applet element is:深入研究启动该小程序的 JS 建议相关的小程序元素是:

<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>

If you create an HTML with that applet element and a codebase of http://tcip.mste.illinois.edu/ , it should work.如果您使用该小程序元素和http://tcip.mste.illinois.edu/的代码库创建 HTML,它应该可以工作。 Mind you, once the applet loaded in my FF, I got simply a 'black screen' (shrugs).请注意,一旦小程序加载到我的 FF 中,我就会得到一个“黑屏”(耸肩)。

BTW - do you have permission from the makers of the applet and the site to use their applet?顺便说一句 - 您是否获得了小程序制造商和网站的许可才能使用他们的小程序?


BTW - I have tested this applet element and seen it work locally!顺便说一句 - 我已经测试了这个小程序元素并看到它在本地工作!


Later: Now I look at your question more carefully, I realize that I never really answered it correctly, because I missed the 'offline' specifics.后来:现在我更仔细地看你的问题,我意识到我从来没有真正正确地回答过它,因为我错过了“离线”的细节。 My bad!我的坏!

By adding the codebase attribute, I was 'cheating' by allowing the JRE to reach back to the originating site for all the resources.通过添加代码库属性,我通过允许 JRE 返回到所有资源的原始站点来“欺骗”。 AFAIU those resources are: AFAIU 这些资源是:

  1. The Jars mentioned in the archive attribute.存档属性中提到的罐子。
  2. The images used by the applet.小程序使用的图像。

This is going to be a little more tricky.这会有点棘手。

Let us assume you want the HTML to be (poorly) named OFFLINE_applet.html, and you want everything located into the powergrid directory.让我们假设您希望 HTML 被(糟糕地)命名为 OFFLINE_applet.html,并且您希望所有内容都位于 powergrid 目录中。 In that case, the structure would be..在这种情况下,结构将是..

  • powergrid电网
    • OFFLINE_applet.html OFFLINE_applet.html
    • jfreechart-1.0.10.jar jfreechart-1.0.10.jar
    • jcommon-1.0.13.jar jcommon-1.0.13.jar
    • jama-1.0.2.jar jama-1.0.2.jar
    • lessons_old_naming.jar课程_old_naming.jar
    • psdataobjects.jar psdataobjects.jar
    • psdisplayobjects.jar psdisplayobjects.jar
    • anl_lpsolver.jar anl_lpsolver.jar
    • zebLP.jar zebLP.jar
    • applet_images applet_images

Actually, not every image in applet_images is required.实际上,并非 applet_images 中的每个图像都是必需的。 This applet only uses about 20 of them AFAIR, but download all of them it and should work.这个小程序只使用了大约 20 个 AFAIR,但下载所有它们并且应该可以工作。

Of course, remove the 'codebase' attribute, or the JRE will still be trying to reach back to the http://tcip.mste.illinois.edu/ site for the resources!当然,删除“代码库”属性,否则 JRE 仍将尝试返回http://tcip.mste.illinois.edu/站点获取资源!

Test it and get back to me.测试一下然后回复我。

Save the result of the php page as html page and open it in any browser.将php页面的结果保存为html页面,在任意浏览器中打开即可。 It the applet does not need a server connection then it will work.如果小程序不需要服务器连接,它就会工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM