0

I've follow a lot of tutos and forum exemple and i've always the same problem.

I've generated a jar file from an applet in netbeans, including class files from my project. My main class (containing the init() method) is in the package caiusapplet and is named CaiusWeb.

My jar file and my html file are in the same directory, and there is the html code :

<!DOCTYPE html>
    <html>
       <head>
       <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       </head>
       <body>
          <applet code="caiusapplet.CaiusWeb" archive="CaiusApplet.jar">
          </applet>
       </body>
    </html>
</pre> 

But I always have the same issue :

java.lang.ClassNotFoundException: caiusapplet.CaiusWeb.

Could you please help me?

Edit 1 :

I've change my html code to

<OBJECT width="200" height="200" data="caiusapplet/CaiusWeb.class" type="application/x-java-applet">
        <PARAM name="code" value="caiusapplet/CaiusWeb.class">
</OBJECT>

I've now another error message :

Exception : java.lang.reflect.InvocationTargetException

What's the matter ? Thanks

Edit 2 :

I've found what was wrong : there was a JFileChooser in my java code. I removed it : everything is working. So now : What's wrong with the JFileChooser and the applet : access rights ? Still trying... Tanks for your help, if you can say to me how work with JFileChooser... I'll be very grateful !

Edit 3 :

That's ok, if you have the same problem : Create au jar file manually from your .class files ans sign it, everything's now ok ! Thaks a lot.

4

1 回答 1

0

当所需的类不在不可用的匹配路径中时会触发此异常,可能是您忘记将该特定类添加到 jar 中。

于 2012-05-03T11:32:52.853 回答