Hello, I noticed while browsing this forum that this topic has been touched on but I didn't see the solution to my problem. I'm in the process of converting an application to an Applet. I knew it used some code that was not browser compatible and required the plugin so it was downloaded and installed. I also used the HTMLConverter program on the html code so I'm sure it is correct. I was doing my testing in Netscape 4.72 and constantly received the message "Applet AppletTest notinited" in the status bar when attempting to run it. The Java Console provided the following information: Plugin version 1.3.1 java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at sun.applet.AppletSecurity.checkAccess(Unknown Source) at java.lang.ThreadGroup.checkAccess(Unknown Source) at java.lang.Thread.init(Unknown Source) at java.lang.Thread.<init>(Unknown Source) at AppletTest.init(AppletTest.java:26) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Anyways, so I dug through all that and found the line that referred to my code and it was the very simple and lovely: 26: Thread t = new Thread(splash); Splash being an extension of Panel that runs some animation. So, I figured ok I've done something wrong... although why I couldn't construct a Thread in my Applet was beyond me. So off to java.sun.com I went to study the discussion forums there. And while there I found a lot of useless information but the occasional reference to Applets working in IE but not Netscape. So being curious I tried it and it worked. The plugin loaded the applet started and everything was fine in IE5. So therefore I'm discarding all the nonsense I read about having to sign the applet and changing the policies (which makes no sense to me anyways... how do I go around changing the policy file on every computer connected to the internet anyways? And if it can't be viewed from the internet what's the point of making an Applet?) Hopefully someone out there can give me some advice as to what is happening and how to solve my problem. While I can't be sure, I'm fairly convinced that I've done nothing wrong in my code since it runs fine in IE5. Thanks in advance for any help.
Joined: May 14, 2001
Kris, Not sure I can help you here, but I have constantly had to de-bug my applets in order for them to run on both IE5 and Netscape 4.72 (or indeed other Netscape versions). They use different runtime environments. In fact, I think Netscape 6 should be the best runtime environment (it's the Sun JRE 1.2 I think), although Netscape 6 seems to be the slowest browser on the face of the earth. Anyway, in my experience, the earlier versions of Netscape are more temperamental with respect to running applets than is IE5. As for running multiple threads in an applet - yes you can definitely do that. Hope someone else can answer the rest of your questions. Cheers Alan
Joined: May 22, 2001
Thanks Alan, I've been studying this all night now and my brain has become kind of fuzzy but I've decided to narrow my question down to a very simple one because of what I've read (and frankly didn't like the sounds of) Here's my imaginary scenario: My Grandmother buys a computer and installs a browser (either IE or Netscape I don't care) and visits my personal website where the HTML code created from HTMLConverter directs her to install the 1.3 plugin. She does this (my grandmother is very talented). She then returns to my website and attempts to view the contents. On my website I have an unsigned applet that constructs a Thread. Let's say the thread (and the entire applet for that matter) simply counts to ten and draws it to the screen just for the sake of simplicity. The question is should the built in security with 1.3 allow my grandmother's browser to load/init/start/run this applet? Or should security prevent all attempts to construct a thread as an attempt to modify a system ThreadGroup? Anyways, thanks to anyone who reads this and knows the answer for humouring my little scenario. If I've misused terminology it wasn't intentional and I'm not trying to play any tricks with the wording. I'm trying to decide if the Netscape plugin is actually doing the correct thing and the IE plugin is failing to be secure (I hope not but that's what it seems like from what I've read tonight) or if IE is correct and the plugin for Netscape is flawed.
Joined: Aug 17, 2001
I found that Netscrape does not like it if you try to start a thread in the Applet's init() method. It will throw a security exception. I got around the problem by starting the thread from the start() method. Now a question: What is the *recommended* way to use Applet.start() and stop() with threads, without using the deprecated Thread.suspend() and resume() methods?...