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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Applet Not Displayed on Browser... 3

Status
Not open for further replies.

Creeder

Programmer
Jul 5, 2000
110
MY
Hi All,

I have created a simple java applet which basically draws a picture of a square. I am using Graphics2D object to achive this.
I have a html form with the applet tags but when the html page is ran, it does not display the square and just a grey applet window.

However running the html page using the appletviewer everything seems to be fine. What could be the problem?

Thanks in advance.

Yue Jeen
 
Try mousing over on the grey applet window, the error message mentioned by pete should appear in the status bar. If this doesn't shed some light on the problem, check the HTML you're using for the "live" version. It may be referencing something incorrectly -- doesn't have the correct path to the .class files etc.

HTH,

Russ
bobbitts@hotmail.com
 
Hi all

Thanks for responding. Basically the class file and the html file is in the same directory. When i open the html file (eg.double click in window explorer) the html file open and when i hover my mouse over it, it says Applet has started, but display a grey window. Using the appletviewer to view the file and everything is ok. There seems to be no error...is it the browser problem? Using IE5...

Thanks

YJ
 
> Using IE5

Turn on the 'Java console' in the options. Then see what information is in there about exceptions. You are probably using a 1.2 API that is not available in the browsers JVM.

Good luck
-pete
 
The browser is the problem, IE5 uses a differnet version of the Java Runtime Files than Sun's version
Click on the link ->at the bottom of the page

Check out the FAQ
area for this forum!

and look for the faq i wrote on how to get around this.. and could you vote for it, thanks :) if you need more specifics just email me.... :)

later


ackka
ackka@mad.scientist.com
duke_wave.gif
Java is the Future
 
Are you using just the <applet> tag? If so, it won't work if you are using any Java 2 packages. Even if you have the new run time installed, you will need to tell the browser to use the Java 2 runtime to run your applet... try:

<OBJECT classid=&quot;clsid:8AD9C840-044E-11D1-B3E900805F499D93&quot; WIDTH = 300 HEIGHT = 510 codebase=&quot; else if (_ns == true) document.writeln('<EMBED type=&quot;application/x-java-applet;version=1.1.2&quot; java_CODE = &quot;HelloSwingApplet.class&quot; java_CODEBASE = &quot;example-swing&quot; java_ARCHIVE = &quot;applets.jar&quot; WIDTH = 300 HEIGHT = 510 pluginspage=&quot;//--></SCRIPT>
<APPLET
ARCHIVE = &quot;acdiva.zip&quot;
CODEBASE = &quot;.&quot;
CODE = &quot;acdtool.AcDiva&quot;
NAME = &quot;TestApplet&quot;
WIDTH = 300
HEIGHT = 510
HSPACE = 0
VSPACE = 0
ALIGN = middle
></XMP>

<PARAM NAME = CODE VALUE = &quot;acdtool.AcDiva&quot; >
<PARAM NAME = CODEBASE VALUE = &quot;.&quot; >
<PARAM NAME = ARCHIVE VALUE = &quot;acdiva.zip&quot; >
<PARAM NAME=&quot;type&quot; VALUE=&quot;application/x-java-applet;version=1.1.2&quot;>

</APPLET>

</NOEMBED></EMBED></OBJECT>

This should work with ie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top