class you specify, but your class file cannot access the local filesystem
unless you sign the applet. This is for everyone's protection. Otherwise an
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.
If I include this line of code in the java file
ImageIcon dukeIcon = new ImageIcon("duke_waving.gif");
niceLabel.setIcon(dukeIcon);
I do expect java to do so
but the applet plugin won't do so, and for a very good reason.
Interesting </Morten>
and not additionally
append an <IMG SRC="filewithpicture.gif"> to the HTML code.
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
ImageIcon dukeIcon = new ImageIcon("duke_waving.gif");
niceLabel.setIcon(dukeIcon);
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.
Ok, it looks like I was wrong.
filesystem other than the original class/jar file it was loaded from. It
it still has no direct access.
In the applet of yours which fails you are attempting to access the file via the