• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

to copy a policy file from server machine to client machine in java

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i have created an applet program which needs a java.policy file to work. i want to run this applet from my webserver. so if my client runs the applet from his machine, he gives the url (http://192.144.1.45:8080/examples/applet/myapplet.html)
the applet downloads well in the client machine, but bcoz i havent given the necessary permissions in his machine, he is not able to run my applet program.my applet program is using socketpermissions to connect,resolve and it access the server program in the webserver. i feel that the java.policy file does not have the necessary permissions. so i am looking for a code to copy the java.policy file to the client machine and overwrite the existing java.policy file in the client. is there any code for that? or is there any workaround for this problem
regards
Kiran
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you digitally sign the applet, you can get whatever permissions you want. There's instructions in the Signed Applets chapter of Advanced Programming for the Java 2 Platform.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe,
Its a nice Article.. But how to deploy the Applet in Tomcat container.. so that we can request the same through a browser or applet viewer.I am getting error..
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bis Bang:
I am getting error..


Share the error with us. We can't read minds, or what's on your computer screen.
It should be easy to deploy on tomcat, just put the signed JAR and the HTML that references it in the same directory under <tomcat_home>/webapps/<web_application_context>
 
Bis Bang
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe I have the following files in a Folder called Signed_Applet..
CompanyCer,compstore, SignedApplet.html, SignedApplet.jar, Write.jp, SignedAppletDemo.class, SignedAppletDemo.java, SSignedApplet.jar same as in the Article.. Now I added the Signed_Applet Folder in the Context path of the server as below..
<Context path="/demo"
docBase="D:\Signed_Applet"\>
Now when I give the following command ...
appletviewer -J-Djava.security.policy=Write.jp
http://localhost:8080/demo/SignedApplet.html
from my working directory say D:/bis.... 1)The Applet starts..2)its shows Signed Applet demo in the body 3)Does not show successfuly created file in the body and 4)gives the the folowing Errors in the command prompt ....from the request been made
D:\bis>appletviewer -J-Djava.security.policy=Write.jp http://localhost:8080/demo
/SignedApplet.html
java.security.AccessControlException: access denied (java.util.PropertyPermissio
n user.home read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:269)
at java.security.AccessController.checkPermission(AccessController.java:
401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
76)
at java.lang.System.getProperty(System.java:573)
at SignedAppletDemo.test(SignedAppletDemo.java:28)
at SignedAppletDemo.paint(SignedAppletDemo.java:55)
at sun.awt.RepaintArea.paint(RepaintArea.java:177)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
at java.awt.Component.dispatchEventImpl(Component.java:3678)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
java.security.AccessControlException: access denied (java.util.PropertyPermissio
n user.home read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:269)
at java.security.AccessController.checkPermission(AccessController.java:
401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
76)
at java.lang.System.getProperty(System.java:573)
at SignedAppletDemo.test(SignedAppletDemo.java:28)
at SignedAppletDemo.paint(SignedAppletDemo.java:55)
at sun.awt.RepaintArea.paint(RepaintArea.java:177)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
at java.awt.Component.dispatchEventImpl(Component.java:3678)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
java.security.AccessControlException: access denied (java.util.PropertyPermissio
n user.home read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:269)
at java.security.AccessController.checkPermission(AccessController.java:
401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
76)
at java.lang.System.getProperty(System.java:573)
at SignedAppletDemo.test(SignedAppletDemo.java:28)
at SignedAppletDemo.paint(SignedAppletDemo.java:55)
at sun.awt.RepaintArea.paint(RepaintArea.java:177)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
at java.awt.Component.dispatchEventImpl(Component.java:3678)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
 
Bis Bang
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its works when i make the request from a browser(http://localhost:8080/demo/SignedApplet.html)..and create a file in my local disk
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bis Bang:
Its works when i make the request from a browser(http://localhost:8080/demo/SignedApplet.html)..and create a file in my local disk


I had that
same problem. It worked in a browser, but not in appletviewer.
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,
well I have also made an signed applet and its running in tomcat aswell as in appletviewer ,well in tomcat we have to use catalina policy file if we want to grants permission to a signed applet or applet.
well see the browser settings and javaconsole in control panel.
thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic