This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes Browsers and jre plugins for applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Browsers and jre plugins for applets" Watch "Browsers and jre plugins for applets" New topic
Author

Browsers and jre plugins for applets

Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
Hi,
On Windows XP I have 3 browsers: FireFox, Mozilla and IE7.
I have had several versions of the java jre installed. The registry currently has 4 versions referenced in the JavaSoft/Java Plug-in and 7 versions in Java Runtime Environment. The JRE CurrentVersion is 1.5.
When looking at an HTML page with an applet FireFox uses JRE 1.6.0, Mozilla and IE7 use 1.5.0.
I have an applet that requires an entry in the .java.policy file to enable it to read files.
When I use FireFox and Mozilla, the applet works. When I use IE7 I get access denied needing FilePermission read.

What determines which jre a browser uses?
How does applet security differ between IE7 and the other 2 browsers?

Thanks,
Norm
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41089
    
  44
In general, there's a control panel called "Java Plugin" (or some such) that lets you pick which JRE to use. I don't think there could be more than one Java Plugin control panel; might be something to check on your machine.


Ping & DNS - my free Android networking tools app
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
Thanks for the response.
There is a javacpl.cpl file with each version in it's bin folder. The .cpl file needs an entry in the registry's to execute. The currently installed versions .cpl file in in a Windows folder and is accessible in the Control Panel.

When I look at the Advanced tab, the <APPLET tag support has IE checked and Mozilla and Netscape NOT checked.

IE and Moz use 1.5. FF uses 1.6
How is that?
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
New observation on IE7 and .java.policy file.
An applet executed in IE7 with the following policy file entry is allowed to write a file:

grant codeBase "file:/D:/JavaDevelopment/Testing/WriteFile/-" {
permission java.io.FilePermission "D:/Testing/writetest.txt", "read, write";
};

It fails if I change the target file to a wild card of - or * :
grant codeBase "file:/D:/JavaDevelopment/Testing/WriteFile/-" {
permission java.io.FilePermission "D:/Testing/-", "read, write";
};

Other browsers work with the wildcard characters.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
I gave up on this for a while. It went away for a while when I updated the jre and then came back with the latest jre (6_U13). So I spent a day and found a workaround.
If I add permissions under the empty codeBase (<ALL>) it works, ie the program is able to read the files in the folders.
The codeBase <ALL> entry from my .java.policy file:

grant {
...
permission java.io.FilePermission "C:/Java/JDK1.6_doc/docs", "read";
permission java.io.FilePermission "C:/Java/tutorial", "read";
};

I tried many different combinations of codeBase, but only this one works.
The expected codeBase works only in Mozilla, not in Firefox or IE.

Does anyone have any ideas on how to findout what codebase the browser/JVM are using?

Norm
 
jQuery in Action, 2nd edition
 
subject: Browsers and jre plugins for applets
 
Similar Threads
Java Plug-In and Firefox
Applet loading from another applet does not work on IE.
Issues with IE and Mozilla Firefox
Can't play Rules Roundup
Problems faced with the new IE8 and Firefox3