2

I try to create my first Applet. which is called MemoSaver2.java

Also I created html:

<html>
<object classid="java:MemoSaver2.class" 
        type="application/x-java-applet"
        archive="MemoSaver2.jar" 
        height="300" width="450" >
        </object>
</html>

and this:

<html>
    <head>
        <title>Memo saver applet</title>
    </head>
    <applet code="ch13.MemoSaver2.class" width = 600 height= 400> 
        Java is not installed. 
    </applet>
</html>

But I always get the same error.

NoClassDefFoundError MemoSaver2( wrong name: ch13/MemoSaver2)

What I should do for running my applet from the browser?

bsiamionau
  • 8,099
  • 4
  • 46
  • 73
Lesya Makhova
  • 1,340
  • 3
  • 14
  • 28
  • What is the URL where we can see the applet fail? Is the applet in a Jar? Is the applet in a package? How do you expect anyone to guess the problem without that type of information? – Andrew Thompson Feb 12 '13 at 12:19
  • Try to remove `ch13`, I'm not sure that it's really needed – bsiamionau Feb 12 '13 at 12:21
  • Andrew, I haven't url with application. all is locally. Yes applet is in package, it's name is: ch13. Name of the source:MemoSaver2.java. If I need jar file I will do it, but in books they tell only about .class file, isn't so? – Lesya Makhova Feb 12 '13 at 13:58
  • about removing ch13 - of course I tryed this before I ask this question. – Lesya Makhova Feb 12 '13 at 13:59
  • when I run applet from the eclipse apllet viewer show me this tag: but when I insert it into my html, I get NoClassDefFoundError. Mb I should place html and class file to another dir, or what it need? mb special jar file? – Lesya Makhova Feb 12 '13 at 14:26
  • 1
    Solution is here: http://stackoverflow.com/questions/11692373/applet-trouble-noclassdeffounderror?rq=1 – Lesya Makhova Feb 12 '13 at 14:31
  • 1
    Glad you got it sorted. :) Maybe you should write up a short answer and when the site allows, accept it. – Andrew Thompson Feb 13 '13 at 10:56
  • Thank you Andrew. I did as you tell :)) – Lesya Makhova Feb 16 '13 at 19:22

1 Answers1

0

List item /home/me/workspace/myProject/bin applet.html

/home/me/workspace/myProject/bin/test SimpleApplet.class

If the class SimpleApplet is in package test put the HTML in the parent directory (as detailed above), and use this HTML.

Lesya Makhova
  • 1,340
  • 3
  • 14
  • 28