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

Similar Messages

  • File Access with unsigned Applet through editing the java.policy file

    I'am starting to lose my hair on this...
    I am trying to get an applet to run so that it can access the file system to move files on my local maschin. Because this applet is only running on my VM i can change the java.policy to avoid the signing of the applet.
    first of all, if i wrote in the java.policy file
    grant {
      permission java.security.AllPermission; 
    };everything is working perfekt.
    But I have not the intention to open the gates for any applet out there, so i want to limit the access to my applet. With every of the following versions I get at best an
    java.security.AccessControlException: access denied (java.io.FilePermission...
    My Setup
    My Java Version: jre1.6.0_02
    My applet is located unter the url
    http://admin.mydomain.com/applet.jar
    In Html i tryed the following different versions of loading the applet - none worked
    <applet codebase="http://admin.mydomain.com/" name="shortcut" code="start.class" archive="applet.jar" width="0" height="0"></applet>
    <applet codebase="http://admin.mydomain.com" name="shortcut" code="start.class" archive="applet.jar" width="0" height="0"></applet>
    <applet name="shortcut" code="start.class" archive="http://admin.mydomain.com/applet.jar" width="0" height="0"></applet>in java.policy i tryed following versions with every html applet load version
    grant codeBase "http://admin.x-press.de/-" {
      permission java.security.AllPermission; 
    grant codeBase "http://admin.x-press.de/+" {
      permission java.security.AllPermission; 
    grant codeBase "http://admin.x-press.de/applet.jar" {
      permission java.security.AllPermission; 
    };why is it with
    grant {
      permission java.security.AllPermission; 
    };working, and not with the other versions?
    i am almost bold now, please try to save my last hair from falling down.
    any suggestion would be nice
    thanks, feyyaz
    Message was edited by:
    feyyazdogu

    I read the mentioned documentation and your right, some of my versions were wrong, but after reading the doumentation again i came to following result which should had worked but didn't.
    java.policy
    grant codeBase "http://admin.mydomain.com/*" {
      permission java.security.AllPermission;
    HTML File
    <applet codebase="http://admin.mydomain.com/" name="shortcut" code="start.class" archive="applet.jar" height="0" width="0"></applet>if I am entering http://admin.mydomain.com/applet.jar i can download the jar, so the archive lays in the correct directory.
    what i am doing wrong? do i have to change an additional file somewhere else?

  • How to read the java class file to convert it in java.

    hello all,
    i m developing the java application which generated the java code from the java 'class file' .
    Can anybody please help me, Is any java support for reading the class file? or how to know the class file format?
    I know the application javad, jad, javap which is doing the same thing.
    thanks for reply,
    - Jayd

    do you mean decompiling? there are tons of java decompilers available out there, what exactly are you trying to do here?

  • How to handle the layout of file in OWB?

    Hi all,
    I am facing one problem..that is
    If my file is coming monthly
    i need to load into datamart.
    But the problem is the layout is not same.
    At the end of the file one field may add or one field may delete..
    The procedure I am following to load data into datamart is "First I am creating External table and then from Eaternal table to Table."
    How can I handle this type of file in OWB
    Pls give me some inputs
    Thanks in advance
    Srinivas

    hi,
    Define the extenal table in the followin way,
    CREATE TABLE sample_extbl
    2 ( col1 NUMBER
    3 , col2 NUMBER
    4 , col3 NUMBER
    5 )
    6 ORGANIZATION EXTERNAL
    7 (
    8 TYPE ORACLE_LOADER
    9 DEFAULT DIRECTORY LOG_DIR
    10 ACCESS PARAMETERS
    11 (
    12 RECORDS DELIMITED BY NEWLINE
    13 nobadfile
    14 nologfile
    15 FIELDS TERMINATED BY ',' LDRTRIM
    16 MISSING FIELD VALUES ARE NULL
    17 )
    18 LOCATION (LOG_DIR:'a.csv')
    19 )
    20 REJECT LIMIT UNLIMITED;
    case 1:
    Now, for example if the file a.csv contains the data as follows.
    col1,col2,col3,col4,col5
    abc,28,xyz,mno,1000
    abc2,38,xyz,mno,2000
    abc3,28,xyz,mno,3000
    Then, if we query the external table "sample_extbl"
    select * from sample_extbl
    Then you get the data as follows
    col1 col2 col3
    abc 28 xyz
    abc2 38 xyz
    abc3 28 xyz
    Case 2:
    Now, for example if the file a.csv contains the data as follows.
    col1,col2,col3,col4,col5
    abc,28,xyz,mno,1000
    abc2,38
    abc3,28,xyz,mno
    Then, if we query the external table "sample_extbl"
    select * from sample_extbl
    Then you get the data as follows
    col1 col2 col3
    abc 28 xyz
    abc2 38
    abc3 28 xyz
    Regards,
    Gowtham Sen.

  • How to handle big java source files in JDEV 10.1.3

    Hi,
    I have some .java files that are like over 10,000 lines long. I know this is crazy but I didn't write it but I have to maintain it. I really dont feel like refactoring all these big source files right now.
    JDeveloper has lots of while-editing features that are probably grinding to a halt on this really big file. My CPU usage shows ~97% whenever I do anything in this file.
    Is there some preferences I could set or something I can disable just while editing this big file.
    Thanks,
    Simon.

    The delays between edits and the IDE stalls seemed
    about the same with this change in place.Ah... that's sad. It seems like there's another (un-configurable) timer mechanism for background parsing used by the structure pane.
    I didn't
    really understand what the numbers were controlling
    so I didn't try any other values. They control the frequency of a timer that is reset each time you press a key in the code editor. After the number of ms specified in these parameters has elapsed after the last keypress, the code in the editor is parsed. There are two settings, one for short files and one for long files (I forget what the threshold is between short and long).
    Maybe it isn't the parser since it still goes to 100%
    CPU (just less often) but I can still move the mouse
    around the file - no stalling. Here's something I'd find useful to investigate this problem: Run jdeveloper with jdev.exe so that you have a console. When the CPU hits 100%, switch to the console and press Ctrl+Break. Copy the stack dump (maybe take a couple of them) and email them to me (brian dot duff at oracle dot com).
    Dropping the structure window is a fairly simple work
    around for me. I can live without the structure
    window for this file although it is actually most
    useful as the file's size, and structure, increases.Yes, I can imagine the structure pane would be quite useful with a mammoth java file like the one you're working with :) Incremental find might be your friend in its absence (Ctrl+E, I think).
    If your considering an ER for the structure window
    (:-) then how about this too:
    "Cursur location within the file should be shown in
    the structure window"
    This already happens for Ant (build.xml) files but
    not for Java files - or at least not for me. The
    problem is that it is easy to get lost in a large
    file and the navigation assistance should be the same
    across all structured file types. Funnily enough, I was talking to one of the developers on the team that builds the infrastructure for the xml based parts of the product (including ant) about these kind of inconsistencies between the XML and Java structure panes just a couple of days ago... :) I'll file a bug for this (rather than an ER), since it's a UI inconsistency.
    Thanks,
    Brian

  • .java.policy file problem

    Is there someone who knows how to reinitialise the java policy file at runtime?
    My signed applet writes a policy file to the users home directory, but that file is only used after closing the browser and surfing back to our page. It should immediatly use that new file.
    Someone who got some experience with that...?
    Regards

    And is it true that if you use a Thawte or verisign certificate, you will not have to change the .java.policy file?

  • ".java.policy" file where is this located

    Hi,
    Where is the .java.policy file located. Do I have to create it? Do I have to use any editor for this? Please help me.
    Thank you,
    Regards
    Uma

    It'll probably be in the lib/security directory of your JRE.
    If you've got a JDK then it'll be something like jdk1.3/jre/lib/security/java.policy

  • Java.policy file  - Must I change it?

    I just got a certificate from Verisign with which I signed my applet. It works fine and now I want to distribute it to a group of users.
    Back when I was developing the applet with a self-signed cert, I changed the java.policy file to allow the applet to do things 'outside the sandbox'.
    I thought, perhaps mistakenly, that when I got the Verisign ceritifcate I would not need to concern myself with java.policy in any way. But now, even with the Verisign cert, my applet won't run correctly w/o the updated policy file.
    This is only important to me as I do not want to go around to 'x' number of user workstations and modify each java.policy file.
    Am I missing something??
    thanks

    You mention
    "you should be able to remove the policy file and users can just accept the certificate "
    I experience the same, remove all policy files, signed applets can then access resopurces on the local machine. However, practically all the documentation I read regarding JAVA 2 (I'm using 1.4.1_02) says you must have a policy file when using a signed applet. At least they say sign your applet and then indicate what the policy file should look like to grant specific permissions for that applet. I find no policy file will still allow a signed applet to access local files... Is this a bug in JAVA 2 1.4.1_02, or the correct behavior. thanks in advance.

  • Where to put java.policy file?

    Under which directory the "java.policy" file must be kept in?

    Hi!
    The policy file must be indicated in the command line or by system property, when you starts the service, like the following: -Djava.security.policy = yourfile.policy. If you want to indicate another directory, you can do like this: -Djava.security.policy = C:\temp\yourfile.policy.
    I hope it helps you,
    Sandra.

  • How to handle the control records in case of file to idoc scenario.

    Hi All,
    can you please clarify me how to handle the control records in case of file to idoc scenario.

    Hi,
    In File to Idoc scenario even though you selected apply control record values from payload and you are not getting those correct values which you have provided in the mapping.
    Also check the checkboxes Take sender from payload and Take receiver from payload along with the Apply control record values from payload checkbox
    Regards
    Seshagiri

  • How to access the *.java file corresponding to a TypeElement T?

    Here is a problem:
    How to access the *.java file corresponding to a TypeElement T from a AnnotationProcessor environment?
    Let us say the hook method
    public boolean process(Set<? extends TypeElement> annos, RoundEnvironment roundEnv)
    is invoked with a TypeElement T such that T.getQualifiedname() = "a.b.c.X"
    And the problem is how to locate the file that has the *.java source code for a.b.c.X?
    That is the file that has the source code for a.b.c.X say "some/path/a/b/c/X.java"?
    For simplicity, let us assume that TypeElement T corresponds to a top-level Java class.

    Pinaki wrote:
    That is not something you as the annotation processor author should be asking about. That is something you the person configuring the javac environment should set up via the -d option or its equivalent.
    I strongly recommend using a separate output directory hierarchy.That is the way the current implementation is. The annotation processor takes a -Aout= <some directory path> to write generated output relative to a user-specified location (which defaults to the class output location).That is contrary to the design of the annotation processing facility. The intended use is for that information to be configured via options like "javac -d".
    Additionally, IMO it is a serious configuration error to put generated files and input files, presumably tracked under version control, in the same directory. Interesting you said that. We are just running some "field trial" with these things and some users want them to be in the same directory of the original *.java files (especially when their source files are spread across many roots) .
    Who knows what the user wants?The user does and the user is free to (mis)configure their environment however they like ;-) However, that is the user's option and the user has control of this via the javac command line. The annotation processor is not the proper place to configure this setting; see slide 7 of http://blogs.sun.com/darcy/resource/J1_2006-BOF-0606.pdf for some thoughts on different roles in annotation processing.
    presumably tracked under version control, in the same directory.version control is another 'usability issues' that we are trying to get our heads around with this stuff. "To check-in or not?" - that seems to be the question. When presented these facilities without any cue, "the users" were divided -- some wanted them to be checked-in, some did not. The context where these generated files being used -- there exists some rationale to check them in a version control system.The right answer depends on the circumstances, but IMO generally generated files should not be checked in under version control, especially if they are derived from other source files. Checking in generated files of this nature just creates the opportunity for them to get out of date with the originating files.

  • How can I rewrite the java.io.file class to a custom file class?

    Hi All!
    Im new to Java. Well, I did some experiments with small Applets. Because it is not allowed to use Files in an unsigned Applet, I need to know, how I can manage to overwrite the java.io.File class. The background: I have to port some Applications which need file access into Applets.
    I think it is necessary to create a class with the same signature then the Java.io.File that stores the information in an database on the Webserver or read information from there. Then overload the java.io.File with my custom file class.
    Is this possible and, if so, how?
    Thanks!

    Hi yawmark !
    Thanks for the quick answer! My idea to store the filecontent into a database is caused by the plan to make the application-port independent from the workstation executing it. So it would be a nice feature storing the "files" into a database.
    JavaBeginner2009

  • How to get the number of files currently open?

    hi,
    does any one know how to get the number of files currently open in windows OS?
    e.g. lets say .txt files...
    any comment will be really appreciated.
    thanks

    Assuming that you don't want to actually do this from within Java code (which would obviously require native code), here's a utility that will give you a list of which file handles are opened by which processes (on Windows):
    http://www.sysinternals.com/ntw2k/freeware/handle.shtml
    - K

  • How to customize the Java Concurrent Program(PO Output for Communication)

    Hi,
    How to customize the Java Concurrent Program(PO Output for Communication)
    I need to add the Line level Ship To Address ,Line Notes and Extended Price fields on Java Concurrent Program.
    Please any body help/guide me in this regard.

    Hi,
    Changing Java Conc. program for "PO Output for Communication" is difficult.
    Actually, if you observe closely, "PO Output for Communication" program uses PO<HEADER/LINES..>_XML views.
    So if you could change these views and add your requireed columns to it, you can automatically see your changes in XML data file.
    See if the following link will you to get there.. http://chandramatta.blogspot.com/
    thanks,
    Matt

  • How to get the current executing file/itself absolute directory?

    hellooo,
              gentlemen/lady, how to get the current executing file/itself absolute directory?
              thanks
              

              Hello,
              you can get the real path information of the JSP through the servlet context:
              http://java.sun.com/products/servlet/2.2/javadoc/index.html
              javax.servlet
              Interface ServletContext
              Method getRealPath
              Christian Plenagl
              Developer Relations Engineer
              BEA Support
              [email protected] (alex mok) wrote:
              >hellooo,
              >
              >gentlemen/lady, how to get the current executing file/itself absolute
              >directory?
              >
              >thanks
              

Maybe you are looking for

  • How can you share Contacts and use Family Sharing?

    Still sharing 1apple ID & 1 iCloud from way back when.  Kids were little, syncing was simple... turned off their device iClouds and synced apps, playlist, shows w/ iMac via usb.  I loved having my contacts, bookmarks, notes synced via iCloud and it b

  • Error while saving or submitting the page

    I have an application with sharepoint2010 and in the code behind visual studio 2012,Innitially evry module was working,but now when i am saving or submitting any page its giving me UNEXPECTED error with a co-relation id. I went through the error log,

  • I am trying to download  OS 10.9.4 and getting error message

    I am trying to download the update OS X 10.9.4 and am getting error (-1100)

  • Display text in ALV

    Hi all, I have a requirement where  text is to be displayed in between the rows. ie, Below the column headings,  I want a subheading.(eg.Data for quantity less than 1000). Then the corresponding data will be populated. Then the next subheading should

  • Changes in events calendar

    Hello I download this event calendar. I try to change starting week from Mondays by changing this: firstDay = firstDate.getDay() + 7;and retyping days in function createCalendar() But after that is not green marked present day. It is but in 2009 year