• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Newbie Help Please.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

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

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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
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.

regards,
Arjun
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic