我无法嵌入一个简单的applet。我认为类文件名的相对/绝对路径的设置是问题。我尝试了许多不同的方法,但没有一个有效。只有一个例外。如果我将indexApplet.html文件放在bin文件夹中,那么它可以工作。但我想将indexApplet.html保留在它之外。我真的很感激这件事的任何帮助。
这是我的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]
类文件位于:C:\ Users \ Valentin \ workspace \ test \ bin \ first
我想将indexApplet.html文件放在测试文件夹之外。
答案 0 :(得分:0)
假设您正在C:\Users\Valentin\workspace
查看小程序,并且在hello
包中声明了类first
,那么您需要添加codebase
属性:
<applet code="first.hello.class" width="800" height="600" codebase="test/bin">