Can';在Eclipse中使用javascript代码从html显示小程序
我尝试使用Eclipse IDE中的javascript代码运行java小程序,如网页所示。但是输出页面显示错误。我使用applet的代码是Can';在Eclipse中使用javascript代码从html显示小程序,java,javascript,eclipse,applet,webpage,Java,Javascript,Eclipse,Applet,Webpage,我尝试使用Eclipse IDE中的javascript代码运行java小程序,如网页所示。但是输出页面显示错误。我使用applet的代码是 <script src="//www.java.com/js/deployJava.js"></script> 试试下面的代码 <APPLET CODE=AppletSubclass.class WIDTH=anInt HEIGHT=anInt> </APPLET> 或 试试这个 Java小程序
<script src="//www.java.com/js/deployJava.js"></script>
试试下面的代码
<APPLET CODE=AppletSubclass.class WIDTH=anInt HEIGHT=anInt>
</APPLET>
或
试试这个
Java小程序
包cdig;
导入java.applet.applet;
导入java.security.AccessController;
导入java.security.PrivilegedAction;
公共类CDigApplet扩展Applet
{
私有静态最终长serialVersionUID=1L;
字符串ret;
CDigApplet applet=this;
@SuppressWarnings({“rawtypes”,“unchecked”})
公共字符串签名文件(字符串文件ID、字符串pin、字符串令牌)
{
AccessController.doPrivileged(新的PrivilegedAction()
{
@凌驾
公共对象运行()
{
尝试
{
System.out.println(“协助程序”);
}
捕获(例外e)
{
字符串sl=“{\'success\”:false,“+”消息\“:\”+e.getMessage()+“\”}”;
ret=sl;
系统输出打印LN(sl);
}
返回null;
}
});
返回ret;
}
公共void init(){
}
公共空间销毁(){
}
}
谢谢您的回复,但它不起作用。结果相同,只是小程序空间中显示了一个错误
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
<APPLET CODE=AppletSubclass.class WIDTH=anInt HEIGHT=anInt>
</APPLET>
<object width="400" height="400" data="helloworld.class"></object>