将applet嵌入到html页面问题中

时间:2014-02-28 15:34:02

标签: java html path applet

我无法嵌入一个简单的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文件放在测试文件夹之外。

1 个答案:

答案 0 :(得分:0)

假设您正在C:\Users\Valentin\workspace查看小程序,并且在hello包中声明了类first,那么您需要添加codebase属性:

<applet code="first.hello.class" width="800" height="600" codebase="test/bin">

阅读:Using applet, object and embed Tags

相关问题