• Post Reply Bookmark Topic Watch Topic
  • New Topic

FileIO  RSS feed

 
A Verma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In applet when I'm trying to creat/read/write file from system in JDK1.2 It gives security problem. If any body has solution please post me in detail how to set security manager and access the file.
Thanks
Ajay Verma
------------------
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ajay,
go to jdk\bin directory and run policytool.exe .
a window will open up,now from this GUI u can permit the file i/o permissions . after granting the required permission save the policy file.let's say c:\polfile.txt
now to run the applet use following commandline
appletviewer -J -D java.security.policy=c:\polfile.txt Applet.html

note : there is no space in
java.security.policy=c:\polfile.txt
regards
deekasha


[This message has been edited by deekasha gunwant (edited October 12, 2000).]
 
A Verma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello deekasha
I rcd ur msg. Thanks for help. But when I run policytool.exe. i gives file did n't find but it open applet. What should I give in
code Base option. when I gave file name with path here it gives this msg "java.net.MalformedURLException: no protocol: c:\jdk1.2\source.txt"
Thanks
Ajay

Originally posted by deekasha gunwant:
Hi Ajay,
go to jdk\bin directory and run policytool.exe .
a window will open up,now from this GUI u can permit the file i/o permissions . after granting the required permission save the policy file.let's say c:\polfile.txt
now to run the applet use following commandline
appletviewer -J -D java.security.policy=c:\polfile.txt Applet.html

note : there is no space in
java.security.policy=c:\polfile.txt
regards
deekasha

[This message has been edited by deekasha gunwant (edited October 12, 2000).]

 
A Verma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It Gives this error after running applet
Exception in thread "main" java.lang.NoClassDefFoundError:
Originally posted by deekasha gunwant:
Hi Ajay,
go to jdk\bin directory and run policytool.exe .
a window will open up,now from this GUI u can permit the file i/o permissions . after granting the required permission save the policy file.let's say c:\polfile.txt
now to run the applet use following commandline
appletviewer -J -D java.security.policy=c:\polfile.txt Applet.html

note : there is no space in
java.security.policy=c:\polfile.txt
regards
deekasha

[This message has been edited by deekasha gunwant (edited October 12, 2000).]

 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi anil,
for your requirement policy file should contain
-------------------------------------------------

-----------------------------------------------------
note : in above line write ALL FILES inside the angular brackets.
so copy above lines save in a file and then use
appletviewer -J -D java.security.policy=c:\polfile.txt Applet.html
to run the applet
right now it should solve your problem.

by the way here is the link meant to solve your problem do visit it.
http://developer.java.sun.com/developer/onlineTraining/Security/Fundamentals/magercises/Policytool/index.html
regards
deekasha


[This message has been edited by deekasha gunwant (edited October 12, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!