File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Newbie Help Please. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Newbie Help Please." Watch "Newbie Help Please." New topic

Newbie Help Please.

Don AnthraX

Joined: Mar 28, 2007
Posts: 1
Hello I just began learning java just a couple days ago, [it is basicly my first language] I seem to have a problem with this tutorial on applets (my applet is broken :tear: )

It tells me to compile this to a class....

and make an html of this and then open the html

<HEAD><TITLE>My first applet</TITLE></HEAD>
<APPLET CODE="myapplet.class" WIDTH=100 HEIGHT=100>

It appears I am getting an error because I do not have a main class but I am not shure, I am doing exactly as the tutorial says is there something I should add. And if it is the main class how and where should I add it.

All help is greatly appreciated,

Regards, iMi

*added* I think it is the html maybye but I do not know as I have no Idea
[ March 28, 2007: Message edited by: Don AnthraX ]
Arjun Karthick
Ranch Hand

Joined: Jan 04, 2007
Posts: 77
did you compile the code successfully.
if so a class file will be generated in the directory where the java file is.
In the HTML you have to give the path of the class file or just mention the class file(myapplet.class), if the class file is in the same directory as the HTML page.

The error is because the HTML page could not fine the required class file.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, first thing is to make sure that Java in installed correctly in your browser. See if you can run any applets from this page. If you can, then the code you poasted should work, provided you have the myapplet.class file in the same directory as the HTML file.

No further class (named "main" or otherwise) is needed.
I agree. Here's the link:
subject: Newbie Help Please.
It's not a secret anymore!