[英]Embed applet into html page issue
I am having trouble to embed a simple applet. 我很难嵌入一个简单的小程序。 I think the settings for relative/absolute path to the class file name are the problem.
我认为类文件名的相对/绝对路径设置有问题。 I've tried many different ways to do it but none have worked.
我尝试了许多不同的方法来完成此操作,但没有一个成功。 With only one exception.
除了一个例外。 If I place the indexApplet.html file inside the bin folder, then it works.
如果我将indexApplet.html文件放在bin文件夹中,则它可以工作。 But I would like to keep indexApplet.html outside of it.
但我想将indexApplet.html保留在其中。 I will really appreciate any help for this matter.
我将非常感谢您对此事的任何帮助。
Here is my html code and folder structure: 这是我的html代码和文件夹结构:
[code]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Java Game</title>
</head>
<body>
<applet code="test/bin/first/hello.class" width="800" height="600" alt="Java Game" title="Go and Play"></applet>
</body>
</html>
[/code]
The class file is located at: C:\\Users\\Valentin\\workspace\\test\\bin\\first 该类文件位于:C:\\ Users \\ Valentin \\ workspace \\ test \\ bin \\ first
I would like to have the indexApplet.html file outside of test folder. 我想将indexApplet.html文件放在测试文件夹之外。
Assuming you're viewing the applet from C:\\Users\\Valentin\\workspace
and the class hello
is declared in the first
package then you need to add the codebase
attribute: 假设您正在从
C:\\Users\\Valentin\\workspace
查看applet,并且在第first
包中声明了hello
类,那么您需要添加codebase
属性:
<applet code="first.hello.class" width="800" height="600" codebase="test/bin">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.