Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applet error

Status
Not open for further replies.

da21

Programmer
Dec 4, 2002
23
US
I am new to applets.If I can get some help on missing environment I would be greatfull.

After going through the documents relating applets on SUN web site.I downloaded HelloWorld.java file in the JDK/bin directory.


import java.applet.Applet;
import java.awt.Graphics;

public class HelloWorld extends Applet {
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}

Compiled it to create the class file.Then created the followin HTML file:

<HTML>
<HEAD>
<TITLE> A Simple Program </TITLE>
</HEAD>
<BODY>
Here is the output of my program:
<APPLET CODE=&quot;HelloWorld.class&quot; WIDTH=150 HEIGHT=25>
</APPLET>
</BODY>
</HTML>


When I type at the internet explorer 6 browser E:\j2sdk1.4.1_01\bin\HelloWorld.html
it displays the above HTML file written.
But does not display the ouput that it is supposed to.
All the files are present under E:\j2sdk1.4.1_01\bin directory.
At the DOS prompt if I type in Appletviewer HelloWorld.html it does the same.

Kindly help me as to what mistake I am making relating the missing environment.

Eagerly awaiting to hear.

thanks
 
Did you activate the JVM in &quot;tools\internet options\advanced&quot; ?
Did you check that Applets were not forbiden in the zone you &quot;surf&quot; in (&quot;tools\internet options\security&quot;) ? Water is not bad as long as it stays out human body ;-)
 

Kindly guide where should I activate from. i am using winows 2000.

Thanks a lot
 
These options are in IE, not in Windows. Water is not bad as long as it stays out human body ;-)
 

Still not working, Sir.I have changed the options in the internet options to make the Applet to run.But still the HTML file is coming on the screen instead the output.

Kindly some more guidance.
 
Do you have the &quot;Java Console&quot; activated in IE? What messages are reported in the console?

-pete
 

I just activated

Microsoft VM
Use Java 2v1.4.1_02 for <applet>
Java console enabled
Java logging enabled

Do I have to run the JAVA Web start before executing the applet.

Thanks
 
>> At the DOS prompt if I type in Appletviewer
>> HelloWorld.html it does the same.

is HelloWorld.class in the same directory as HelloWorld.html?

-pete
 


>>>is HelloWorld.class in the same directory as HelloWorld.html

Yes it is.

There is a small erro message that I see When I click the Java plug in in the control pannel it gives me a message that &quot; IT COULD NOT FIND THE MAIN CLASS PROGRAM will exit&quot;

does that imply something.
 
Have you used your browser to run an applet from some public web site? This will verify that your system is configured properly.

-pete
 


Oh ! Yes I think. For example If I go to e:/j2sdk1.4.1_01/demo/Clock directory and click on exampl1.html with Clock1.java and the class file present it gets executed with the clock running on the screen.

thanks
 
Ok when i run the clock example here is what my console displays in the first few lines that depict system configuration


Java(TM) Plug-in: Version 1.4.0
Using JRE version 1.4.0 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\T15BKMN.NYL-CORP


that appears to be different than yours, yes?

-pete
 


>Java(TM) Plug-in: Version 1.4.0
U>sing JRE version 1.4.0 Java HotSpot(TM) Client VM
>Us>er home directory = C:\Documents and >Settings\T15BKMN.NYL-CORP

__________

That is true,Sir.

And I have mentoined earlier if I double click the Java plug in in the Control Panel it gives me a message that &quot; IT COULD NOT FIND THE MAIN CLASS PROGRAM will exit&quot;
 
da21, i'm at a complete loss.

I created all files (HelloWorld.java/html) compiled the .java to a .class using Forte and opened the .html file by droping it onto IE 6 and everything works fine. Below is the complete output in the &quot;Java Console&quot;, not that there is anything of use to you other than some indications that your system (Java/IE) configuration is not supporting what you are trying to do.


Java(TM) Plug-in: Version 1.4.0
Using JRE version 1.4.0 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\T15BKMN.NYL-CORP

Proxy Configuration: Manual Configuration
Proxy: http=webproxy:80,https=webproxy:80,ftp=webproxy:80,gopher=webproxy:80
Proxy Overrides: <local>





----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system properties
t: dump thread list
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top