【发布时间】:2015-05-26 12:30:20
【问题描述】:
我尝试使用 Eclipse IDE 中的 javascript 代码运行 java 小程序,如网页 Embedding Java Applet into .html file 中所示。但是输出页面显示错误。我使用小程序的代码是
<script src="//www.java.com/js/deployJava.js"></script>
在头部和
<script>
var attributes = {
codebase : '../src/',
code : 'transfol.Main.class',
//archive: 'my-archive.jar',
width : '800',
height : '500'
};
var parameters = {
java_arguments : '-Xmx256m'
}; // customize per your needs
var version = '1.5'; // JDK version
deployJava.runApplet(attributes, parameters, version);
</script>
在正文部分。
我保存它们的方式在导航器中显示为 src 文件夹(在 Eclipse 中)中的包 transfol 中的 Main.class 和 Web 内容中的 index.jsp
其中 Main.class 是小程序,index.jsp 是从中调用小程序的文件。
我几乎可以肯定问题出在必须指定路径的代码库或代码属性中,当我单击有关小程序的更多信息时,出现以下异常:
发生了以下异常。有关更多信息,请尝试从命令行启动浏览器并检查输出。 如需更多信息,您可以访问http://icedtea.classpath.org/wiki/IcedTea-Web 并按照其中描述的步骤了解如何获取必要信息以提交错误 控制台或日志中可能会提供其他信息。如果启用调试,则可以获得更多信息。
另一个可用信息: IcedTea-Web 插件版本:1.5 (1.5-1ubuntu1) 26/5/15 下午 5:56 例外是:
net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize applet. For more information click "more information button".
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:746)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:675)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:908)
Caused by: java.lang.ClassNotFoundException: Can't do a codebase look up and there are no jars. Failing sooner rather than later
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:716)
... 2 more
This is the list of exceptions that occurred launching your applet. Please note, those exceptions can originate from multiple applets. For a helpful bug report, be sure to run only one applet.
1) at 26/5/15 5:47 PM
net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize applet. For more information click "more information button".
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:746)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:675)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:908)
Caused by: java.lang.ClassNotFoundException: Can't do a codebase look up and there are no jars. Failing sooner rather than later
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:716)
... 2 more
【问题讨论】:
标签: java javascript eclipse applet webpage