我有一個小程序,它直接在我的html頁面中。它使用4個其他文件。我得到一個NoClassDefFound錯誤。我的HTML文件在同一目錄作爲我的.class文件,看起來像這樣:Java小程序NoClassDef找到錯誤
<html>
<body>
<h1>Here is my Asteroids game!</h1>
<applet codebase = "." code = "Asteroids.class" name = "Asteroids" width = "640" height = "480" hspace = "0" vspace = "0" align = "middle">
</applet>
</body>
</html>
我使用Internet Explorer和我的其他小應用程序正常工作。我需要在我的<applet>
標籤中包含其他文件嗎?
完整的錯誤:
Java Plug-in 10.6.2.24
Using JRE version 1.7.0_06-b24 Java HotSpot(TM) Client VM
User home directory = C:\Users\Stafford
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
堆棧跟蹤:
asteroids:(wrong name asteroids/Asteroids)
Asteroids類和它的構造函數都是public類嗎? –
我們可以得到一個完整的堆棧跟蹤。你的Asteroid.class是否需要其他類文件?如果是這樣,你將不得不將它們全部打包在一個罐子裏。 – thatidiotguy
@ S.L。 Barth是的,但它沒有構造函數 – imulsion