Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't run appletTest.html, pliz help?

 
cyril wanda
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
New to java(beginner),trying to run applet and getting this warning< applet> tag requires code attribute. pliz explain?
Pliz recommend nice book for begining java.
thanks
[This message has been edited by Marilyn deQueiroz (edited September 21, 2001).]
 
Rob Acraman
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By doing "View Source", I see the warning is "APPLET tag requires CODE parameter".
The applet tag MUST HAVE a CODE="name of class file" parameter -eg.: < APPLET CODE="myapplet.class" WIDTH=10 HEIGHT=20>
See http://java.sun.com/products/jdk/1.1/docs/guide/misc/applet.html
for more details.
As for a good book, check out JavaRanch's own bunkhouse: http://www.javaranch.com/bunkhouse/bunkhouseBeginning.jsp
If you decide to buy one of them, order via the BunkHouse and that way you're also helping to support JavaRanch (because it'll get a commission from Amazon - "Hoooo Doggy" I believe is the common phrase)
Which book is the best? That really depends on your own personal taste, how much experience you have with other languages, etc. Personally, I really like Bruce Eckel's "Thinking in Java", and what's really nice is you can get a good look at it by downloading the entire book for free It's at http://www.bruceeckel.com (which leads you to http://www.mindview.net/Books/TIJ ). If you're serious about studying it, of course, you'll want it on paper - and buying the book is cheaper than the cost of all those ink cartridges you'd use printing it!
Best of luck,
Rob
 
Michael Fitzmaurice
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cyril
When you use the applet tag in html, the browser expects to find an attribute within that tag which indicates the name of the relevant compiled Java class (the one extending Applet). Your tag should therefore look something like:
<code>
<pre>
< applet code="MyApplet.class" <br /> width="400"<br /> height="300">
</applet>
</pre>
</code>
A good book for beginning Java? I found both "Java In A Nutshell" by David Flanagan on O'Reilly and "Java 2 How To Program" by Deitel & Deitel on Prentice Hall to be pretty useful. The Deitel book in paticular covers many different aspects of the language at an introductory level, and is full of examples of code.
Hope this helps
Michael
------------------
"One good thing about music - when it hits, you feel no pain"
Bob Marley
[This message has been edited by Marilyn deQueiroz (edited September 21, 2001).]
 
Michael Fitzmaurice
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cyril
Sorry, replied to your question but wrote the code for the applet tag directly into the answer. I thought this would be fine if I enclosed it in code tags, but apparently I was wrong. Hence, completely disregard the mess you see above this post. The applet tag confuses things, so I won't put a literal example in this post.
Anyhow, the problem is you need to supply some attributes within the applet tag in your html. At a minimum, you should include height and width, plus the code attribute, which is the one causing your current problems. This attribute specifies the name of the Java class that extends Applet e.g. "MyApplet.class"
A good book for beginning Java? I found both "Java In A Nutshell" by David Flanagan on O'Reilly and "Java 2 How To Program" by Deitel & Deitel on Prentice Hall to be pretty useful. The Deitel book in paticular covers many different aspects of the language at an introductory level, and is full of examples of code.
Hope this helps
Michael
[This message has been edited by Michael Fitzmaurice (edited September 17, 2001).]
 
Rob Acraman
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those pesky APPLET tags! They hid my reply for some reason. Here it is again:
By doing "View Source", I see the warning is "APPLET tag requires CODE parameter".
The applet tag MUST HAVE a CODE="name of class file" parameter -eg.: APPLET CODE="myapplet.class" WIDTH=10 HEIGHT=20>
See http://java.sun.com/products/jdk/1.1/docs/guide/misc/applet.html
for more details.
As for a good book, check out JavaRanch's own bunkhouse: http://www.javaranch.com/bunkhouse/bunkhouseBeginning.jsp
If you decide to buy one of them, order via the BunkHouse; It won't cost you any more, but you're helping to support JavaRanch because it'll get a commission from Amazon
Which book is the best? That really depends on your own personal taste, how much experience you have with other languages, etc. Personally, I really like Bruce Eckel's "Thinking in Java", and what's really nice is you can get a good look at it by downloading the entire book for free! It's at http://www.bruceeckel.com (which leads you to http://www.mindview.net/Books/TIJ ). If you're serious about studying Java, of course, you'll want it on paper - and buying the book is cheaper than the cost of all those ink cartridges you'd use printing it!
Best of luck
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put a space between the < and the word "applet" and everything will show up better.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic