File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes java applet error (new to this sorry) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "java applet error (new to this sorry)" Watch "java applet error (new to this sorry)" New topic
Author

java applet error (new to this sorry)

Dj Driver
Greenhorn

Joined: Nov 11, 2011
Posts: 16
Just trying to learn the basics of applets and stuck at the beginning:

I have a file named: SimpleApplet.java with code:

import java.awt.*;
import java.applet.*;
/*
<applet code="SimpleApplet" width=200 height=60>
<applet>
*/

public class SimpleApplet extends Applet {
public void paint(Graphics g) {
g.drawString("Java makes applets easy.", 20, 20);
}
}


When I type: appletviewer SimpleApplet.java at the command line I receive:

C:\Users\Douglas\JavaABeginnersGuide\Chapter14>appletviewer SimpleApplet.java
Warning: <applet> tag requires code attribute.

No idea what the error message is and I do have the path correct as shown below:

C:\Users\Douglas\JavaABeginnersGuide\Chapter14>appletviewer
Usage: appletviewer <options> url(s)

where <options> include:
-debug Start the applet viewer in the Java debugger
-encoding <encoding> Specify character encoding used by HTML files
-J<runtime flag> Pass argument to the java interpreter

The -J option is non-standard and subject to change without notice.

If anyone can help me to get this to display in the Applet Viewer I would appreciate it. Using the most recent Java 7 and working from the book, ch. 14, Java A Beginners Guide (fully updated for JDK 7) from Oracle

Thanks in advance
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
The second "<applet>" should be "</applet>" instead.
Dj Driver
Greenhorn

Joined: Nov 11, 2011
Posts: 16
and after reading your reply I implemented it and it worked. Thank you

p.s. - I also noticed that I missed the / in the book example.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java applet error (new to this sorry)
 
Similar Threads
Applet Security Manager
First Applet
appletviewer
applet viewer not coming up
applets