File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Browsers and jre plugins for applets

 
Norm Radder
Ranch Hand
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Norm Radder
Ranch Hand
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic