Code Comments
Programming Forum and web based access to our favorite programming groups.Nigel Wade wrote: > > No, it's not a contradiction. Applets require a web server, and they load images > from the same web server as they were themselves loaded from (or from with in a > jar obtained from the same server). If you attempt to load an applet from the > local filesystem, as you have done here, then the JVM classloader can load the > class you specify, but your class file cannot access the local filesystem > unless you sign the applet. This is for everyone's protection. Otherwise a n > applet which you accessed via some random URL would be able to access your > filesystem, which I'm sure you don't want to be allowed. > > > but the applet plugin won't do so, and for a very good reason. > Interesting </Morten> > > Huh? > I will discuss the HTML <IMG SRC=""> tags later. </Morten> Hi Nigel, What! Applets require a web server? Interesting. http://tinyurl.com/35dt2b http://tinyurl.com/3dr2e4 http://tinyurl.com/3a2268 http://tinyurl.com/2vf3cw http://tinyurl.com/2t856d this shows that some works and others woun't work. esp this one http://tinyurl.com/35dt2b it works like charm from the Apache/2.0.61 (Unix) Server at xxxx Port 80 with images and permissions and no jar file and this one http://tinyurl.com/2t856d always fails with nasty stack trace. And the Red X image displayed where the applet should be, except when run from the appletviewer. the example I'm using which is supposed to work both has as Java code and in the html file containing the <applet> ... </applet> tag also has an html tag like <IMG SRC="filewithpicture.gif"> In the docs IIRC I at least remember to have read something like <applet> is incorrect it should have been <object> </object> but since there are so many different browsers the safe and old fashioned way is the traditional way and still IIRC if I remember correctly the recommended tag is in 2008 the <applet>. My interpretation of this is in order to be browser compatible also as an additional safety tag also to include an <IMG> tag. This can be due to the population of nonstandards proprietary web browsers. I'm not discussing safari, Opera or Linux web browsers. but this is about a java applet and I feel it would be nearly correct to create an html file containing only the <applet> </applet> tag like this <applet code=PreviewApplet2.class width="400" height="200"> </applet> Applets require a web server is an incorrect statement. file:///usr/jdk/instances/jdk1.6.0/demo/applets/TicTacToe/example1.html works like charm in my browser in my applet viewer and from my homepage and it has pictures. I think it must be a misunderstanding. please take a close look here. [url]http://java.sun.com/docs/books/tutorial/deployment/jar/examples/TicTacToe.html[/ur l] <title>TicTacToe</title> <hr> <applet code=TicTacToe.class width=120 height=120> </applet> <hr> <a href="TicTacToe.java">The source.</a> For me this looks like an implementation without any signature on the jar file. and the html <IMG> tag is not present, so I will keep it out of my example code for the moment. Currently I have not done the effort with signing jar files or creating an applet as a jar file. best regards Morten
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.