File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes can't run appletTest.html, pliz help? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can Watch "can New topic
Author

can't run appletTest.html, pliz help?

cyril wanda
Greenhorn

Joined: Sep 17, 2001
Posts: 1
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

Joined: Dec 03, 2000
Posts: 89
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

Joined: Aug 22, 2001
Posts: 168
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).]


"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
Michael Fitzmaurice
Ranch Hand

Joined: Aug 22, 2001
Posts: 168
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

Joined: Dec 03, 2000
Posts: 89
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

Joined: Jul 22, 2000
Posts: 9053
    
  12
Put a space between the < and the word "applet" and everything will show up better.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't run appletTest.html, pliz help?