File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Problems in creating policy Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "Problems in creating policy" Watch "Problems in creating policy" New topic
Author

Problems in creating policy

Sushma Rao
Greenhorn

Joined: Mar 15, 2001
Posts: 2
hi,
I am a beginner in writing java applications. I wrote an applet which would create a file in my local memory. I also tried creating the policy file so that the applet would have access to the memory. But was unable to creat a policy. My doubts are as follows :
1) When creating a policy what address should the codebase contain ? I tried giving "C:\jdk1.2.1\bin" the directory where i have stored my applet...i get an error "java.net.MalfomedURLEXception:no protocol:C:\jdk1.2.1\bin"
I need to give access to a applet stored in my local memory. So i let this field be empty.....but it still didn't work.
2) Can i create a policy to give my applet access to my local datbase? If so how?
3) Where should i save my policy so that it gives access to my applet ? I tried storing it in the same directory as the applet.....but didn't work.
I would appreciate it if somebody could help me out.
Thanks,
Sushma
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
1) When creating a policy what address should the codebase contain ? I tried giving "C:\jdk1.2.1\bin" the directory where i
have stored my applet...i get an error "java.net.MalfomedURLEXception:no protocol:C:\jdk1.2.1\bin"

I would leave this blank.
Can i create a policy to give my applet access to my local datbase? If so how?
I know you can, but not sure how! Sorry.
Where should i save my policy so that it gives access to my applet ? I tried storing it in the same directory as the
applet.....but didn't work.

It depends on your OS. It (.java.policy) should be located
(generally) in your home dir.
On Unix its your home dir (do a cd <return> and you will be
in your home dir)
ON NT it is where your profile is stored. Generally
C:\winnt\profiles\username
On Win '98, I am not sure, I have to check this!
I will and let ou know.
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Sushma Rao
Greenhorn

Joined: Mar 15, 2001
Posts: 2
Thanks Madhav for your reply.
I tried running the applet again and it worked....i had missed running the applet with the policy file.
My other doubt is if i leave the codebase blank....what does it mean ? Am i giving access to all the applets ?
Well i'm working on the 'giving access to the database part' too. Do let me know if u can find out anything regarding this.
I want to know if there is any other way of doing the same...or is creating a policy file the only solution.
Thanks,
Sushma.
[This message has been edited by Sushma Rao (edited March 16, 2001).]
[This message has been edited by Sushma Rao (edited March 16, 2001).]
 
 
subject: Problems in creating policy
 
Threads others viewed
help me starting my first lesson in JAVA
get directory name from the local file system
Need help in choosing the better approch. (SAX/DOM)
tree in frame, frame in applet
Urgent: Is signed applet really necessary to read local files ?
MyEclipse, The Clear Choice