• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Newbie Help Please.

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: ) http://www.mandomartis.com/onlinecourses/basicgamedev/chapter2/chapter2.html

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 ]
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
    Bookmark Topic Watch Topic
  • New Topic