I have been away from java for a few years, but I have been back to it for a few months now. I'm working on putting together a web site and I'm at the point where I'm experimenting with using Java applets in a web page. I spent many hours trying to get my own code working with applets, but no luck there. So, I decided to back up and go to examples that I knew, or at least I thought I knew, would work.
I dug out an example from Core Java Volume 1, edition 8, by Hortsmann and Cornell. The example is from chapter 2 of that book and is called 'WelcomeApplet'. There are 2 files, WelcomeApplet.java and WelcomeApplet.html. I compile the java file first. I then run 'appletviewer Welcome.html'. The html code is not displayed, but the applet comes up and displays as expected, meaning that a window pops up, the title is displayed, and two buttons with labels appear.
When I go to my browser (I tried using firefox and chrome), the applet comes up, but only the html is processed. The applet itself does not get processed. Thus, in the browser, I only see the html, but no buttons from the applet class.
I'm having the same problem with the example that I am having with my own code: I cannot get an applet tag in my html file to be processed by the browsers. I'm baffled and I figure I must be missing something obvious. It appears that when the applet tag is read by the browser, it is not finding the WelcomeApplet.class file, but that is a guess. My understanding is that with the html file and class file in the same directory, the class should be found.
I got the example code doing the following:
1) Go to http://horstmann.com/corejava.html 2) scroll down the page to the "Further Information" section
3) At the 2nd bullet item "Download Code:", click on "8th Edition" and download the zip file
4) unzip the downloaded file
5) change director to the v1ch02/WelcomeApplet directory from the unzipped code
6) The files WelcomeApplet.html and WelcomeApplet.java are there to be viewed
Thanks for your input. As I mentioned, I was experimenting. My intent was to evaluate if there is any performance advantage to using applets vs other styles. The fact that the technology is fading away is a good reason to drop this experiment now. Throw in the security risks and it is even a better reason to stop here.