Peter Griffin
Peter Griffin

Reputation: 779

How do I turn an applet I made in Eclipse into something that will run in a web browser?

How do I go from the Eclipse project to making a file that will run the applet in a browser? From what I understand, I have to make it into a .jar file and then make an html file with the applet tag, like follows:

<html>
  <body>
    <applet name="TerisApplet.java" code = "TetrisApplet.jar">
    </applet>
  </body>
</html>

I do this and I run into nothing but trouble. Right now I am receiving a ClassNotFoundException. What am I doing wrong?

If someone can walk me through step by step from getting the Java Applet from Eclipse into an applet running over a browser, that would be awesome. This is for my own learning experience btw and not for school. I'm pretty good with Java I think but fairly new to applets.

Upvotes: 0

Views: 93

Answers (1)

rango
rango

Reputation: 56

1) the code should be

<html>
    <body>
       <applet code="name.class"
                       width="500"
                        height="250"/>
       </body>
   </html>

2) you must add your .class file to the folder in which your html file is located for this just search your name.class file and ther would be two files one with a $ sign , copy them both to the folder which contains your .html file

In "name.class","name" means your class name and you can take width and height as you want this is just an example.

Upvotes: 1

Related Questions