HELP: How do i include a policy file when embedding a JApplet

This is the problem i'm facing.I've been able to successfully grant my japplet permission to access resources on the c: drive. When i run it using appletviewer there's no problem, it's able to access the database on the c: drive but when i embedd it in my html page it fails to access the database (i.e it is unable to include the policy file). Does anyone know how to get around this problem?

You can not directly include a policy within an applet. This would be a security risk.
In general you have 2 choices if you wish to grant an applet more rights than it has per default:
1. You can sign it.
2. You change your local policy file.
ad 1:
You can generate a keypair using keytool and sign the applet with jarsigner. (you need to create a jar file first)
when your applet is then loaded in the browser, a popup asks the user, if he wanna trust the signer. If the user clicks no, the applet is executed with standard applet rights. If the user clicks yes, the applet is executed with full permission (like an applet from file:/*)
ad 2:
use policytool to create/change a policy file in your home directory. You can describe the applet either with a path (=codebase) or with some meta-information like signer.
create a policy that fits your need, and save the file.
next time you execute your applet in the browser, the policy will grant the applet additional permissions.
There is a third option. You can mix 1 and 2.
You can sign your applet, and create a policy for all applets signed by you.
Then there will be no popup, and the applet has automatically the rights you defined in the policy file.
But I would suggest to consider the possibility to write a stand-alone application, instead of granting an applet access to the local hard disk.

Similar Messages

  • How can  I include my database file into my jar file?

    Hi,
    I am doing several tests for the jar command....
    I tried to put the database file into my jar file, but when the program run, it just couldn't find the database file, so how may I include the database file into the jar file? Not only that, it also can't find the policy file etc.

    sorry, I think I found the solution, I should have had read the API more carefully.

  • How to handle the java.policy file ?

    Can somebody tell me how to handle the java.policy file?
    I always get java.net.SocketExceptions and java.security.AccessControlExceptions while connecting to an appserver from an applet.
    What do I have to write in the java.policy file, where do I have to place it and do I have to call it in some way form my applet?
    Thanks in advance.
    don call

    The java.policy file goes in your jre installation directory in .../jre/lib/security (there should be one there already).
    I used it to allow otherwise restricted permissions for an applet using javax.comm. Add something like the following to the file:
    grant codeBase "URL:http://yourDomainName/rootDirectoryOfYourApp/*" {
         permission java.security.AllPermission;
    This will give the applet downloaded from your site all permissions. You might want to give only certain permissions, I don't know.
    Teri

  • [svn:osmf:] 15114: Don't check policy file when loading SWFs.

    Revision: 15114
    Revision: 15114
    Author:   [email protected]
    Date:     2010-03-29 12:24:58 -0700 (Mon, 29 Mar 2010)
    Log Message:
    Don't check policy file when loading SWFs.  Don't import local SWFs into current security domain.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/ImageLoader.as
        osmf/trunk/framework/OSMF/org/osmf/elements/SWFLoader.as
        osmf/trunk/framework/OSMF/org/osmf/elements/loaderClasses/LoaderUtils.as

    If you managed to get to the point where the applet container is created (the "gray square"), but the form never appears then you can assume one or more of the following has occurred:
    1. The JRE crashed after startup. Many times, but not always, if such a crash occurs it will leave a JRE dump file on the desktop. Its content may help to identify the cause.
    2. The Forms runtime crashed at startup. Many times, but not always, a Forms dump file will be created on the server. Its content may help to identify the cause.
    3. The Forms runtime was unable to start at all. This can occur on unix systems when/if there is a resource or permissions issue. One of the more common causes is if the file descriptor (nofiles) value is set too low.
    4. The applet is actually running, but has attempted to display a dialog box and is awaiting your acknowledgement, but the box was wrongfully sent to the background behind the browser. A similar issue was reported in one of the JRE 1.6.0_xx series, however I don't recall which one. Uninstall your current version and install the latest which is 1.6.0_27
    There are other possibilities, but these are most common.
    I would recommend the following:
    1. Uninstall any JRE older than 1.6.0_27. Reboot. Install 1.6.0_27
    2. Set networkRetries=5 in formsweb.cfg
    3. Set FORMS_TIMEOUT to 15 (default). Setting to a high value as you have is not recommended and is rarely necessary.
    4. Verify that the test form works. For example:
    http://machine:port/forms/frmservlet?form=test
    5. It appears that you are trying to use WU_TEST_106.fmx. Instead, download an updated version of this file (the name has also changed)
    http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/196249.zip
    6. Ensure that you have compiled webutil.pll into .plx. Do not use an old version of this file. The installation will include one. If not, check for it in an installation that also includes the Builders.

  • How do I read a winmail file when it is attached to an e-mail?  It doesn't open the right way in Excel on my iMac.

    How do I read a "winmail" file when it is attached to an e-mail?  It doesn't open in Excel on my imac, just code...help! 

    Winmail is for Windows only. Excel does not open emails.
    Ask the sender to send the file in a more up to date format.

  • How do I split a pdf file when the file size is too large?

    How do I split a pdf file when the file size is too large?  Thanks!

    With Adobe Acrobat.  It can also optimize your document to make the size smaller.

  • How do you use .wsse policy file from Java Client?

    I'd like to call a WSSE enabled web service from my Java client but setup my encryption/signing requirements with a .wsse policy file.
    I know how to call a web service by programmatically setting up the security headers as described in:
    http://e-docs.bea.com/workshop/docs81/doc/en/core/index.html
    But how can I do the same thing by simply using a .wsse file?

    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    import java.net.*;
    public class links extends java.applet.Applet {
       Panel panel = new Panel();
       public links(){
          super();
          add(panel);
          Link link = new Link(this,"Answers for programmers;- ","http://forum.java.sun.com");
          panel.add(link);
       public void init(){
          setVisible(true);
       public class Link extends Label implements MouseListener {
          Applet applet;
          Color fcolor = Color.blue;
          Color lcolor = Color.pink;
          String text;
          String word;
       public Link(Applet ap, String s, String s1){
          super(s);
             this.applet = ap;
             this.text = s;
             this.word = s1;
             addMouseListener(this);
          setForeground(fcolor);
       public void paint(Graphics g){
       super.paint(g);
          if (getForeground() == lcolor){
             Dimension d = getSize();
             g.fillRect(1,d.height-5,d.width,1);
       public void update(Graphics g){paint(g);}
       public void mouseClicked(MouseEvent e){
          try{
             URL url = new URL(word);
             applet.getAppletContext().showDocument(url,"_self");
          catch(MalformedURLException er){ }
       public void mouseEntered(MouseEvent e){
          setForeground(lcolor);
          setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
          repaint();
       public void mouseExited(MouseEvent e){
          setForeground(fcolor);
          setCursor(Cursor.getDefaultCursor());
          repaint();
    public void mousePressed(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
       public static void main (String[] args){
          new links(); 
    }

  • How to install unlimited strength policy files with 2003 windows server

    Hi all,
    I am working on encryption AES 256 bit key encryption.
    128 is default encryption key.But for use 256 bit encryption key need to add unlimited strength policy file with jdk.
    That is working fine on windows xp.
    Now problem
    But when i run on client machine with operating system windows 2003 server standard.
    I replaced all files under folder Java\jdk1.6.0_10\jre\lib\security with files which i am using on windows XP.
    Restarted the computer after update files but on windows server 2003 256 bit key encryption not working.
    Giving following exception
    java.security.InvalidKeyException: Illegal key size or default parameters
         javax.crypto.Cipher.a(DashoA13*..)
         javax.crypto.Cipher.a(DashoA13*..)
         javax.crypto.Cipher.a(DashoA13*..)
         javax.crypto.Cipher.init(DashoA13*..)
         javax.crypto.Cipher.init(DashoA13*..)
    Please suggest me how to run encryption on windows server 2003..
    Thanks
    Anu

    anu1106 wrote:
    I replaced all files under folder Java\jdk1.6.0_10\jre\lib\security with files which i am using on windows XP.Why? Why not just install the unlimited strength files in the normal way according to the installation instructions given in the distribution file?

  • How to resolve problems in policy file of signed Applet

    Hi to All,
    I want to connect the web site through my Signed Applet which is working as a Proxy server. but i m facing certain problems in my policy file:
    this is my policy file :-
    grant {
    permission java.security.AllPermission "", "";
    permission java.net.SocketPermission "http://www.google.com:4321", "connect, accept,resolve";
    permission java.security.UnresolvedPermission;
    n i got such type of exceptions n my Applet prompt applet not initialized.
    Got connection Socket[addr=/192.168.1.232,port=1200,localport=4321]
    Reading request...
    URI is: http://www.google.com/
    Host to contact is: www.google.com at port 80
    Got request...
    java.security.AccessControlException: access denied (java.net.SocketPermission www.google.com resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
    at java.security.AccessController.checkPermission(AccessController.java:427)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1117)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
    at java.net.InetAddress.getAllByName(InetAddress.java:1061)
    at java.net.InetAddress.getByName(InetAddress.java:958)
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:124)
    at java.net.Socket.<init>(Socket.java:179)
    at ProxyApplet.handle(ProxyApplet.java:75)
    at ProxyApplet.<init>(ProxyApplet.java:132)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:721)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:650)
    at sun.applet.AppletPanel.run(AppletPanel.java:324)
    at java.lang.Thread.run(Thread.java:595)
    here 4321 is Port no. which i've as a random port no.
    plz Help
    thnx in advance
    with regards
    pank_naini

    Please, if you can't help me, could you tell me who can I contact ?

  • How can I attach a policy file to a applet in IE55?

    I want to use jdbc in applet, so I had to run IE55 with a policy file, how can I set it?
    thant u very much.

    Search the JDBC forum. It has been explained in there.

  • How can I change the policy file?

    I have designed an applet to read a file from the local Machine.
    This applet thro a servlet reads the contents of the file specified.
    I use Tomcat 4.1.12 server and this is an client-server application.
    To read the file in the local machine, I set the permission as follows in the .java.policy file in the Local Machine.
    grant codeBase "http://MyMachine:8080/Example" {
    permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
    as the applet file is in the Example of the server "MyMachine".
    Its working and my applet is able to read the file from the local machine it runs.
    Now my problem is I cannot set/change the policy file in every machine where my applet runs.
    Instead if there is a way to change the policy when the applet downloads,that'll be effective.
    That is I donot want to go and change the policy file manually in each and every machine where my applet runs(I donot even know which are the machines going to run the applet).
    Is there any means to acheieve my need?
    Please explain me in detail or direct me to the relevent web sites or links.
    Thank you

    Hi Hosuke,
    I had the same problem, thanks for the advise.
    Still I have a remark to make.
    The thing is that, in order for the applet to have the permission granted (for whatever), you need to have a policy file which you can include in the JAR file (like you explained before) AND also you need to add an entry in the java.security file (located for me: "C:\Program Files\Java\j2re1.4.1_01\lib\security\java.security") that tells the applet where to find all the .policy files.
    Something like: policy.url.4=file:/c:/java.policy
    But since we are talking about an applet we are not able to make changes to this file.
    Maybe you or anyone else knows a workaround for this problem.
    Thanks in advance,
    Ronald Vromans.

  • Help, How to encrypt database exp  backup files?

    Hi all,
    Now, My customer want to encrypt the database backup file. We use exp command backup database, and the backup files can be restored on other servers.
    So, How to encrypt database exp backup files?
    Thanks.
    Eric David.

    Hi;
    In addition to Aman post, please mention your db and OS version,so we can help you more specificly.
    I also suggest please see below googling which mention and explain rman+encrypted backup
    http://www.google.com.tr/#hl=tr&sa=X&ei=dCAtTpuwHMjOswa1gOH3Dw&ved=0CBUQBSgA&q=RMAN%2Bencrypted+backup&spell=1&fp=503f556dbe78c402&biw=1280&bih=797
    Regard
    Helios

  • How can I include a javaScript files from within jsf component

    Is there any way using which I can include javascript files from my jsf component. Because otherwise I have to write all the javascript commands using writer.write which is very tedious rather than this I just want to include the javascript file which contains all the functions required. Also I want that this file should be included only once irrespective of the number of components included.
    Thanx in advance

    This doesn't depend on JSF. You need to include a script tag, like:
    <script src="/path/script.js"
    language="JavaScript" type="text/javascript"></script>
    If you want to include this only once, make a file included into every page, into which you can put other resources to be included along with this script.
    HTH,
    rs.

  • How can i include a jsp file in servlet?

    hi
    i generate a dynamic page from servlet.
    i need to include a jsp file in same servlet.
    i try like this --
    out.println("<HTML>");
    out.println("<HEAD><TITLE>First</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<%@ include file=\"abc.jsp\">");
    out.println("<FORM>");
    out.println("</FORM>");
    out.println("</BODY>");
    out.println("</HTML>");

    Replace your line with
    RequestDispatcher rd = request.getRequestDispatcher("abc.jsp");
    rd.include(request, response);

  • Need help - How to check online status of file?

    Hi.
    I'd like to make my flash app checks whether a particular file is online.
    Let's say this file is 1MB. How do I make it so that when the flash app checks the URL of the file, it won't download the whole thing?
    That is, once the flash app confirms that the file is up, it immediately cancels the download and displays a status message that the file is up. And if there's a 4xx or 5xx message, it will report appropriately.
    I'm a total newbie, so I don't know how to go about this. I'd appreciate it if you could point me in the right direction.
    Thanks.

    you can use the filereference class'es download() method and its listener's onProgress() method.

Maybe you are looking for

  • Using User Defined Global Functions

    Hi, I am implementing Error Handling in a package. The logic goes like this: If the call to the first interface fails, KO will call the error proc using which error message is extracted, written to a file and an email notification is sent. The code g

  • Converting Filename Encoding

    Hello, I am trying to extract a .zip archive that contains CJK characters in its filenames. It was most likely created on a Windows machine. I tried the unzip utility and it produced invalid symbols. The same with 7za, but with slightly different one

  • HP Pavilion 23fi

    Hi, I have 2 HP Pavilion 23fi monitors connected to my Macbook Pro (retina) and everything was working perfect. Today suddenly approx 1/5 (perhaps less) on one of the monitors became utterly strange. It seems like the effected area has a lower resolu

  • How to clean disk up

    Have taken off my pictures and music off main disk and transfered to seperate drive, computer start up now very slow how do I clean the disk up to get back to original speeds?

  • Can you change flash storage to normal storages

    CCan you change flash storage for normal storage