简体   繁体   English

将 java applet 类包含到我的网页中

[英]Include java applet class to my web page

How can I include my java applet class into my web page using JSP on a netbeans web application project.如何在 netbeans Web 应用程序项目上使用 JSP 将我的 java applet 类包含到我的网页中。 I don't want it as a jar.我不想要它作为一个罐子。 When I use a jar it works correctly.当我使用 jar 时,它可以正常工作。 I have a package named "com.example" which is the applet named Scan.java Also have a web page named main.jsp which I added the code below.我有一个名为“com.example”的包,它是名为 Scan.java 的小程序还有一个名为 main.jsp 的网页,我在下面添加了代码。

I am using this code to include the class but我正在使用此代码来包含该类,但是

<APPLET CODE="Scan.class" WIDTH=150 HEIGHT=250>

On the browser the applet doens't open and it says "ClassNotFoundException"在浏览器上,小程序没有打开,它显示“ClassNotFoundException”

How to fix that?如何解决?

类“Scan”应该与您的 HTML/JSP 页面位于同一目录中,或者您可以指定相对路径(来自 JSP)以使用属性 CODEBASE 到达您的 Scan.class。

<APPLET CODE="Scan.class" CODEBASE="../classes/com/example" WIDTH=150 HEIGHT=250>

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

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