i Am A Beginer In The Field Of Java.....my Question Is I M Using Jdk1.3 But The Programs On Awt Is Not Running On The Complier.so Do I Need To Download Extra Software/package For That.....even The Applet Programs R Not Running...help Me
Printable View
i Am A Beginer In The Field Of Java.....my Question Is I M Using Jdk1.3 But The Programs On Awt Is Not Running On The Complier.so Do I Need To Download Extra Software/package For That.....even The Applet Programs R Not Running...help Me
Tell us detailed exception. What do you get when you try to run AWT applications?
WHEN I TRY TO RUN THIS SIMPLE PROGRAM :
import java.awt.*;
import java.applet.*;
<applet code="hourglass" width=230 height=210>
</applet>
public class hourglass extends Applet {
public void paint(Graphics g) {
int xpoints[]={30,200,30,200,30};
int ypoints[]={30,30,200,200,30};
int num=5;
g.drawPolygon(xpoints,ypoints,num);
}
}
AS SOON AS I GIVE THE COMMAND javac hourglass.java it says
hourglass.java:4: 'class' or 'interface' expected
<applet code="hourglass" width=230 height=210>
^
1 error
wat t do
I suggest you to read this applets tutorial before going on. :)
You put HTML code inside your Java class. Those lines should be in an html file. When the compiler see those HTML lines, it gives error to you. Read the tutorial i sent. You will see your mistake.
Thanks for ur valuable suggestion but now a new problem arise an applet is loaded on the desktop but it is blank and also it states that::::
applet not initialized
at the bottom of the applet.....
m i wrong again at something????
Hi Theres a mistake in your applet code
<applet code="hourglass" width=230 height=210>
</applet>
instead of this there should be <applet code="hourglass.class" width=230 height=210>
</applet>
dont forget to put .class extension otherwise your program wont work.....
thanks neha for ur help i tried wat u pointed out but the problem still persists
:( :( :(
The applet should return an exception. You need to learn the details about the exception. What is it and which line the exception is being thrown? These details should be shown on Java Console. Check following resources:
Java Plug-in Console
Enable and View Java Console Window - 1.4.2_xx
After knowing the details about the exception, we can advise you a solution.
You know your program is perfect I ran it on my machine and its giving me the output without any error.
do one thing make a new file and then copy and paste ur prog and then run it
Thanks Neha But I Would Be Glad If U Could Tell Me What Commant U Gave To Run The Program
Oops I Got It Correct This Time.....
Thanks Neha And Javabean
:d :d :d :d :d