Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with applet

 
Vids
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a small applet program as follows:
import java.applet.*;
import java.awt.*;
public class FirstApplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("hello world",25,50);
}
}
It compiled fine. But when I run the program it gives the following error:
C:\jdk1.2.2\bin\java.exe
Working Directory - D:\shrividya\myprogs\
Class Path - C:\jdk1.2.2\lib\tools.jar;.;d:\kawa\kawaclasses.zip;c:\jdk1.2.2\jre\lib\rt.jar;c:\jdk1.2.2\jre\lib\i18n.jar
Usage: java.exe [-options] class [args...]
(to execute a class)
or java.exe -jar [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-? -help print this help message
-X print help on non-standard options
Process Exit...
in the Kawa editor.
What should I do to resolve this error???
Thanks,
Vids
 
Prabhu Chandrasekaran
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think you are trying to execute an applet using java.exe which is used to execute applications written in java.
Try to execute the applet using an Applet Viewer or open it in a browser as part of a HTML file in the <applet> </applet> tags.
Reply back if this solves the problem.
Prabhu.V.C
 
Prabhu Chandrasekaran
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think you are trying to execute an applet using java.exe which is used to execute applications written in java.
Try to execute the applet using an Applet Viewer or open it in a browser as part of a HTML file in the "<applet> </applet>" tags.
Reply back if this solves the problem.
Prabhu.V.C
 
Vids
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was a small mistake in classpath. In customize-options of Kawa editor I had to give the path for Java lib Directory as "C:\jdk1.2.2\lib" for which I had given as "c:\jdk1.2.2\lib". After correction the problem is solved.
Thanks,
Vids
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic