Ulf Dittmer wrote:An IDE does not emulate a full-blown web server/web browser environment. The applet environment in particular is rather different, so I wouldn't expect any AppletContext/AppletStub methods to work properly.
Ulf Dittmer wrote:Are you running Tomcat and the applet standalone now, without the help of any IDE? That's what I advocated, but I can't tell from your post whether or not that's what you're doing.
Ulf Dittmer wrote:You'll probably continue to have problems with this applet unless you deploy and run it from a web server (like Apache or Tomcat).
Ulf Dittmer wrote:Tomcat is free.
An IDE simply is not the same as a JVM running the applet in a browser; just accept it.
A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser.
Paul Clapham wrote:Java tutorials and Java books have always, as far as I can see, assumed that you already knew that an applet was a thing meant to be run in a browser, and therefore it must come from a web server. Although the Oracle server does say right up front
A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser.
So it's reasonable to say that you should have known that too. But you just need an ordinary web server which can serve HTML pages and the like, not an application server like Tomcat and definitely not a JEE server like Glassfish.
However if you don't intend to have a web site which serves your applet to the world at large, or at least to other computers, then there isn't much point in writing an applet.
Ulf Dittmer wrote:What you need is a web server (which is what I said in my fist post). I later on mentioned Tomcat because in my experience it's one of the easiest to set up and get going with, but any server that contains a web server component will do - Apache httpd, Tomcat, GlassFish, IIS, etc.
Consider Paul's rocket mass heater. |