Read file from local disk (little bit urgent, thanks)

Hi all. We're facing a problem using a signed applet. We think it's a matter of versions of the java plugin. The fact is that with version 1.4.0 there's no problem on reading a local file from the applet. Not the same can be said when using version 1.4.2_0X. In fact the applet crashes throwing the following exception:
java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\rgallart\Mis documentos\aaa.rtf read)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkRead(Unknown Source)
     at java.io.FileInputStream.<init>(Unknown Source)
     at appletupload.AppletUpload.fitxerOk(AppletUpload.java:265)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
     at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
     at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
     at java.security.AccessController.doPrivileged(Native Method)
     at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
java.lang.Exception: java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\rgallart\Mis documentos\aaa.rtf read)
     at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
     at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
     at java.security.AccessController.doPrivileged(Native Method)
     at sun.plugin.com.DispatchImpl.invoke(Unknown Source)There was no need to configure any policy file in the local system with version 1.4.0 and also writing a file to disk works fine. Is it necessary to do so on higher versions?
Any help would be appreciated.
Thanks for your time.

Hola Ramon!
java.security.AccessControlException: access denied
(java.io.FilePermission C:\Documents and Settings\rgallart\Mis documentos\aaa.rtf read)I don't know much about signed applets, but I've seen this exception very
recently with my own work with unsigned applets.
If you put this in your policy file, all access problems should go away, whether your
applet is signed or unsigned. But this would apply to any applet that uses the
same policy file.
grant {
permission java.security.AllPermission;
If you want something less radical and more sophisticated, check out the syntax here: http://java.sun.com/j2se/1.3/docs/guide/security/PolicyFiles.html
Another way round the access problem is to locate the file to be accessed on the same
host as your applet, and open it as an url resource. This works with an unsigned applet
with default security, so it whould work with a signed applet too. (In my so called logic at least :)
I can post a code example of this here if you want one.
There was no need to configure any policy file in the
local system with version 1.4.0 and also writing a
file to disk works fine. Is it necessary to do so on
higher versions?Honestly, I don't know. But it looks that way, doesn't it?
Matilda

Similar Messages

  • How can I get file from local disk?

    hi, in my project, I store the files in server local disk, and store file name in Database. How can I get the file according to the file name in database? which means the file names in database are mapped to the file in local disk. How Can my application get the file according to the file name in DB?
    PS: file name are show on one web page as link, when user click the link, user can either open the file immediately or download to local PC.

    Hi Ashutosh
    You will have to use sapcar.zip which contains the utility Sapcar.exe utility for unzipping the files from SAP compressed files. (*.car file)
    Regards
    Gaurav
    PS: Reward points if solved

  • Reading files from local hard disk - Access Local Files Only

    Hi All,
    I have a local flash file published as 'Access Local Files Only', to allow me to read from local filesystem.
    What methods or classes can I use to read text and other files from the user's harddisk.
    This is the first time I am trying to do something like this, all help is grealy appreciated.
    Thanks
    Andy

    Hi, thanks for the responses
    I did some searching and found that the urlloader class is the right one for the job.
    'Access Local Files Only' option is provided for this very purpose I believe.
    If anyone has done something like this and have some sample code it would be awesome
    Cheers
    Andy

  • Reading files from hard disk

    hi,
    i have a following scenario
    I have list of files in a directory. i want to read all those file names and put in a table.
    eg. e:\backup\1.sql
    e:\backup\2.sql
    e:\backup is the directory containing files 1.sql 2.sql etc. I want to get the file names and store those names in a oracle table
    any suggestions
    thanks
    kedar

    I believe you would need to write a Java stored procedure that would use the Java Directory object to iterate over the files in a directory for this sort of thing.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • [Urgent] How to read files from different directories?

    I am new to Java Programming, I would like to know how to read files from directories other than the current one? (example as follows)
    ProjectDirectory
    |--MainDirectory
    |--MainProgram.java
    |--SupplementDirectory
    |--SupplementProgram.java
    |--Pictures
    |--Image.gif
    What should I write in the MainProgram.java so that I can use the supplementProgram.java from MainProgram and read the Image.gif file from the MainProgram.java?
    Thanks

    Run through the I/O tutorial here. It should get you up to speed on this sort of thing...

  • Reading file from a folder : File dir = new File(URL+aFile_to_add);

    Hi,
    Trying to read files from a dir on my site using a JSP and bean. I've tried nearly every option for the filepath I can think of and it doesn't seem to be finding the file...
    Here's the bit:
    String URL = "images\\wedding_photos\\";
    File dir = new File(URL+aFile_to_add);
    String[] files = dir.list();
    It's working locally, but I obviously had to change the path from c://... to the above.
    The full code is listed below in the addWedding Method
    The method removes the .jpg from the file name and then writes the new file name to a database
    Thanks for any insight.
    Regards
    Jim
    public String addWedding(String aFile_to_add)
    String feedback = "unset in scrubWedding";
    try
    String URL = "images\\wedding_photos\\";
    Class.forName("org.gjt.mm.mysql.Driver");
    java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/rhwedd2_shop?user=**********&password=*******");
    java.sql.Statement statement = connection.createStatement();
    File dir = new File(URL+aFile_to_add);
    String[] files = dir.list();
    if (files == null)
    feedback = "Sorry, couldn't find the file "+aFile_to_add+"...no files have been added.";
    else
    for (int i=0; i<files.length; i++)
    // Get filename of file or directory
    String filename = files;
    String no_extension;
    //convert string array element into a char array
    char [] charsfilename = filename.toCharArray();
    int newlength = charsfilename.length -4;
    no_extension = String.valueOf(charsfilename,0,newlength);
    filesAdded = filesAdded+", "+no_extension;
    // Show the new file names in stack trace without extension
    //System.out.println("String no_extension " + no_extension );
    statement.executeUpdate("INSERT INTO items VALUES ('"+no_extension+"',5,'"+aFile_to_add+"')");
    // write to table with item_id and weddingid
    feedback = "The following files have been added..."+filesAdded;
    if (statement != null )
    statement.close();
    if ( connection != null )
    connection.close();
    catch(Exception e)
    feedback = "Into the catch";
    e.printStackTrace(System.err) ;
    return feedback;
    }//end addWedding

    String URL = "images\\wedding_photos\\";
    File dir = new File(URL+aFile_to_add); ok, ok, I'll answer...
    1) What gives you the impression that the relative directory "images\\..." exists (or, in other words, what makes you think your current directory is the parent of "images"?

  • Reading files from a browser on clients PC

    is there anyway to read files from clients PC through browser in java, apart from signed applets.....
    plz help , its very urgent......

    taking the browser to be IE, suppose the following situation:
    a web application is running on client PC, and on click of a button, i have to generate a report in some format and insert some images in that report which are on clients local drive and their path is known to me say C:\ myimage.jpg.
    if the mages were on the server(where web application is hosted), then its not a prob.[b]
    so for doing such a thing what i have to do means, what setting i have to change of the browser .....what security setting of clients PC has to be changed...
    and how to get jar signed.
    plz tell me the procedure to do this....

  • During restore of my backup on iphone 5s i saw my photos and videos get doubled on ios 8.0 and moreover if i use to go at my computer and then open my iphone and in folder i see some files name local disk and my photos please help my memory doubles.

    during restore of my backup on iphone 5s i saw my photos and videos get doubled on ios 8.0 and moreover
    if i use to go at my computer and then open my iphone and in folder i see some files name local disk and my photos
    please help my memory doubles.

    I'm not sure, but I know it's not recommended to upgrade to iOS 8 on anything older than an iPhone 5. I only lost my music playlists and music that was on my phone, but that music is also on my iTunes, not the playlists though, and I don't want to go through ALL my iTunes library to fix it either... But it seems I don't have a choice right now.
    Whatever you do, do NOT upgrade to iCloud Drive, keep iCloud till OS X Yosemite comes out, if your computer is a Mac. I also just noticed that all my documents on my phone are gone from Pages, BUT if I go on the iCloud website they are still there. Hopefully it will all work itself out when I can update my macbook pro to OS X Yosemite.
    If you backed up your phone and all your purchases off your iPhone prior to trying to upgrade you should be fine... But I'm not even remotely sure.

  • Com.ms.securityExceptionEx in IE -- started from local disk

    Hi,
    I use an applet that connects via intranet to a database. I know about all the security issues related to that, but here's the problem:
    ** it used to work: **
    - starting the applet from my local disk, it did work before in the browser (IE, security settings medium or low). starting it from the file/web server, it didn't work due to the security issues ('access denied').
    - changing the java.policy settings and using the plug-in and HTMLCOnverter, it obviously did work also when loading from file/web server.
    ** it doesn't work anymore: **
    - days later, it doesn't work anymore without using the plug-in. security settings low, starting from local disk!! The message is:
    com.ms.securityExceptionEx[myapplet.mymethod]: cannot access myhost.
    I found this error message here in the forum, but often related to sockets or rmi. My applet is as simple as you can imagine and doesn't use any sockets or rmi. It works using appletviewer. Microsoft says sth. like 'an untrusted applet tries to execute a trusted method'. Something messed up with my IE? Is there any java.policy-like file or option for IE?
    Thanks for any help
    Buck

    Please find a solution and forward it to my mail ID: [email protected]

  • Command to install a package.pkg.tar.xz from local disk

    What's the command to install a package.pkg.tar.xz from local disk.

    I'm pretty sure with a little effort and the knowledge contained in our wiki, the man pages, and the forum, you could have found this yourself. Easily.
    This forum is not a hotline.

  • Reading file from an external folder.

    Iam tring to read an external file from the C:\ drive. Given below is the code.
    DATA LV_XLS(100) TYPE C.
    DATA LV_CONTENT TYPE XSTRING.
    LV_XLS = 'C:\XML\Report.xls'
    READ DATASET LV_XLS INTO LV_CONTENT.
    But when i execute iam getting an error - FILE NOT FOUND. How do i read file from an external folder. My requirement is to strictly read from an external folder. Please help.
    If this is not possible please advice as to how the file could be moved to the SAP root directory. Iam not able to locate the root.

    hi,
    This is the code to read a excel file from the local system.
    Read data set you are using in your code corresponds to files on application server thats the reason its throwing an error.
    * Parameter variable declaration for browsing the file location       *
    PARAMETERS:
      p_file TYPE ibipparms-path OBLIGATORY.
    data:
    it_text TYPE truxs_t_text_data .
    AT SELECTION-SCREEN  ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
       EXPORTING
         program_name        = syst-cprog
    *   DYNPRO_NUMBER       = SYST-DYNNR
         field_name          = ' '
       IMPORTING
         file_name           = p_file.
    START-OF-SELECTION.
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_tab_raw_data             = it_text
          i_filename                 = p_file
        TABLES
          i_tab_converted_data       = t_cust
      EXCEPTIONS
        conversion_failed          = 1
        OTHERS                     = 2
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    This is to read a text file from local system.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
        filename                      =  'D:\FILEINTERFACE\file.TXT'
    *    FILETYPE                      = 'ASC'
         has_field_separator           = 'X'
    *    HEADER_LENGTH                 = 0
    *    READ_BY_LINE                  = 'X'
    *    DAT_MODE                      = ' '
    *    CODEPAGE                      = ' '
    *    IGNORE_CERR                   = ABAP_TRUE
    *    REPLACEMENT                   = '#'
    *  IMPORTING
    *    FILELENGTH                    =
    *    HEADER                        =
        TABLES
          data_tab                      = t_kna1
    *  EXCEPTIONS
    *    FILE_OPEN_ERROR               = 1
    *    FILE_READ_ERROR               = 2
    *    NO_BATCH                      = 3
    *    GUI_REFUSE_FILETRANSFER       = 4
    *    INVALID_TYPE                  = 5
    *    NO_AUTHORITY                  = 6
    *    UNKNOWN_ERROR                 = 7
    *    BAD_DATA_FORMAT               = 8
    *    HEADER_NOT_ALLOWED            = 9
    *    SEPARATOR_NOT_ALLOWED         = 10
    *    HEADER_TOO_LONG               = 11
    *    UNKNOWN_DP_ERROR              = 12
    *    ACCESS_DENIED                 = 13
    *    DP_OUT_OF_MEMORY              = 14
    *    DISK_FULL                     = 15
    *    DP_TIMEOUT                    = 16
    *    OTHERS                        = 17
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    PS.  In both of the above mentioned function modules make sure that the file structure is similar to the internal tables used.
    Thanks
    Sharath

  • Copy a file from hard disk to a jar

    Is there any way to copy a file from hard disk to a jar file?

    hajani wrote:
    No, I want to copy a file into an other jar file (like a zip or a rar file)
    Edited by: hajani on Dec 7, 2008 4:11 AMIf you really do mean 'jar' file an not 'zip' or 'rar' then you can use class java.util.jar.JarFile and write your own code. If you don't feel like writing a load of code then and you can guarantee that the 'jar' executable is going to be available then you could use Runtime.exec() or it's cousin ProcessBuilder. If you mean a 'zip' file then you could use class java.util.zip.ZipFile and write a load of code. If you mean a 'rar' file then you will either have to find a 'rar' class library or again use Runtime.exec().

  • Copy file from local host to remote host

    Hello,
    I need to copy a simple file from local file system , to another computer on the same network.
    How should i do that in a simple java program ?
    Thanks !

    Well , I tried that from winXP to winXP on another machine and it worked great :
           InputStream in = new FileInputStream(new File("C:\\temp\\myFile.txt"));
            OutputStream out = new FileOutputStream(new File("\\\\9.143.85.143\\c$\\tmp\\myFile.txt"));
            // Transfer bytes from in to out
            byte[] buf = new byte[1024];
            int len;
            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            in.close();
            out.close();
      BUT, in order to copy to a linux machine, I tried to put this as the new File :
    OutputStream out = new FileOutputStream(new File("\\\\9.143.86.145\\root\\tmp\\myFile.txt"));
      and it doesn't work. How should I format the new File path in order to copy to a linux FS ?
    Thanks !

  • Copy file from local system to Azure VM using powershell

    Hi
    Is there a simple powershell command to copy a small file from local computer to Azure VM. Point to Site is not an option for me.
    I am hoping for something simple like
    Copy-Item C:\Wabash\Logfiles\trasfer.txt -Destination C:\Presentation -ConnectionUri $uri -Credential $credential
    similar to Invoke-Command
    The only other option i have seen is 
    http://www.mattwrock.com/blog/copy-files-from-local-computer-to-an-azure-vm
    which i fell for my purpose is over kill.

    Hi,
    I will mark Ed's post as answer, if you fount that doesn't give you help, please feel free unmark it and follow up with more information.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Read file from presentation server (like GUI_UPLOAD)

    Hi,
    I need to read a txt file from local pc path in CRM WEB UI runtime. The path and the filename are already known, so I don´t need the control provided by thtmlb:fileUpload control, which automatically adds a u2018Browseu2019 button. I need to read this file without any additional controls or buttons.
    I tried with RZL_READ_FILE, but doesn´t work with local files, only with application server files.
    As you all know, GUI_UPLOAD doesn´t work in WEB UI...I need exactly something like that!
    Any help or suggestion wil be appreciated.
    Thanks in advance.
    Federico.

    Hi Federico,
    When it comes to web browser (web ui) file upload cannot be done as it is done in SAP GUI. There is a mechanism called 'Form-based File Upload in HTML' through which file is uploaded from web browser to the server, at the back end this is what is used. So you have to use a fileUpload tag to upload a file from web browser.
    As an alternative solution, you can use Javascript and activexobjects to upload files. I have developed a wiki which explains excel upload using activexobjects and javascript.
    http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebUI-UploadingdatafromExcelfiles
    Regards,
    Arun

Maybe you are looking for

  • Wifi no longer works after 7.1 upgrade

    verizon/frontier router. tried multiple fixes got it to work once for 5 minutes.  usually says unable to access.  i hate upgrading my phone it always something.  Samsung coming out next week.....  Anyone got any fix that has a good sucess rate?  rese

  • Items purchased using 2 accounts, cant sync?

    We purchased several apps and songs using 2 different iTunes account and 2 different computers to an iPhone4. Now, the old computer is not functional anymore. We are left with the second computer ONLY. With this said, we cannot authorize the old comp

  • Mail/Session configuration problem. please help me

    am using tomcat 4.1 in my server.xml file gave the following lines <Resource name="mail/Session" auth="Container" type="javax.mail.Session" /> <ResourceParams name="mail/Session"> <parameter> <name>mail.smtp.host</name> <value>hostName</value> </para

  • My daughters nano 6th gen is deleted how to restore

    Everything is erased from the nano how can I restore everything back onto the nano.

  • Is LAN access turned OFF for Time Capsule guest network by default?

    Hello! I just crated a guest network on Time Capsule with OS X 10.9.4 AirPort Utility. Could someone tell me if LAN network is unaccessible from Guest network?  My shared folders, TC disk and so on. I use DHCP and NAT for Internet connection sharing.