Dani,

You will have to do something similar

        new URL(getCodeBase(), "DisplayApplet.html");

Because you cannot access the local drives. You only have the access to where your 
applet was loaded from, and getCodeBase() will give you that path. This will work if 
both the applet and the file you are trying to access are in the same directory. I 
have never done it with files being in different directories, but thats possible too.

Ahmed

-----Original Message-----
From: Daniel Moscoso [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 24, 2001 1:20 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Configuring java.policy for testing fileloaders in
local from an applet.


Hi all !

I'm writting an application that uses the NCSA Portfolio loader. It's working fine 
from the command line but gives security exceptions if I try to run it as an applet 
with a navigator. I also tried to configure the java.policy file to grant all 
permission, or FilePermission, for the files but it doesn't work.

For example, the applet is located at C:\Java\Source\Test. Its name is 
DisplayApplet.class. The HTML file that opens it is DisplayApplet.html. This applet 
has to read the 'portfolio.properties' file, and afterwards an obj file. I have 
configured the policy.file with several entries:

     Codebase: 'file://C:/Java/Source/test/-' or 
'file://C:/Java/Source/test/DisplayApplet.html'
     Permission entries:  File Permission: AllPermission or FilePermission  
TargetName: portfolio.properties or the .obj file            Entries: read

But nothing of this works. I save the java.policy file in the directory where the JRE 
is installed: C:\Program Files\JavaSoft\JRE\1.3\lib\security.

What am I doing wrong ? Or the only way to test fileloaders in an applet is to make 
signed jar files ?
How can I test them ?

I'm expecting your help.
Thanks in advanced !!

Dani



--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn 
Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, 
informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das 
unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to