Can an applet loading from a browser read from local file system?

I have to load my applet from a browser, and the "browse" button on it should be able to select and read certain files in the local file system( or the files located under the server's home directory). Is there a way to address the security issue? I know there are ways to enable an appletviewer to do it, but how about a browser?

You'll need to have a signed applet.

Similar Messages

  • It is difficult, to organize my contacts on my iPhone. It is easy to do this on my iMac. So why can't I load my well organized contacts from my iMac (addressbock) on my iPhone and overweight my disorganized contacts on my iPhone?

    It is difficult, to organize my contacts on my iPhone.
    It is easy to do this on my iMac addressbok.
    So why can't I load my well organized contacts from my iMac (addressbock) on my iPhone and overwrihte my disorganized contacts on my iPhone?

    Read the User's Guide, it will reduce the number of questions you ask which reveal to the world your intelligence or lack there of.

  • How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap?

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class? These are the keys,values: TreeMap The data I'd like to Cache is (date from the file, time of the file, current time).
    import java.io.*;
    public class CacheData {
      public static void main(String[] args) throws IOException {
      String target_dir = "C:\\Files";
      String output = "C:\\Files\output.txt";
      File dir = new File(target_dir);
      File[] files = dir.listFiles();
      // open the Printwriter before your loop
      PrintWriter outputStream = new PrintWriter(output);
      for (File textfiles : files) {
      if (textfiles.isFile() && textfiles.getName().endsWith(".txt")) {
      BufferedReader inputStream = null;
      // close the outputstream after the loop
      outputStream.close();
      try {
      inputStream = new BufferedReader(new FileReader(textfiles));
      String line;
      while ((line = inputStream.readLine()) != null) {
      System.out.println(line);
      // Write Content
      outputStream.println(line);
      } finally {
      if (inputStream != null) {
      inputStream.close();

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class?
    I don't understand your question.
    If you don't know how to use TreeMap why do you think a TreeMap is the correct solution for what you want to do?
    If you are just asking how to use TreeMap then there are PLENTY of tutorials on the internet and the Java API provides the methods that area available.
    TreeMap (Java Platform SE 7 )
    Are you sure you want a map and not a tree instead?
    https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html

  • Signed Applet - Problem reading large local files

    Hello,
    I am using a signed applet (self-signed) to read files from a clients machine (local file system). Following is the code for buffered reading (the meat):
    String thisLine, ret = "";
    try{
         BufferedReader myInput = new BufferedReader(new FileReader(fn));
         while ((thisLine = myInput.readLine()) != null) {
         ret += thisLine + "\n";
         myInput.close();
    catch (Exception e) {
         ret = "Cannot load, exception!";
    When I read a file <= 512KB, it runs fine/as expected. Now, when I read a file, say for example 1024KB in size, I expect the application to take twice as much time (than 512KB file) and read the file, but instead the applet/browser hangs. As a matter of fact I am not able to read files > 512KB.
    So, is there a limit on file size (from local file system) when reading from an applet, or is it to do with the way I am reading it?
    Any help, suggestions or comments would be highly appreciated.
    Thanks in advance.

    Here is how I read a file from my applet:
         private String getData(String u) {
              URL url = null;
              InputStream in = null;
              String ret = null;
              try {
                   // the following line wil read a file @ the same location as your class file
                   // this way your applet does not need any special privileges
                   // you could change the url to a file if so needed
                   url = new URL(this.getCodeBase(), u);
                   URLConnection conn = url.openConnection();
                   // next line is optional and just tells the http server
                   // a utf-8 response is accepted
                   // some servers will return a bad request
                   conn.setRequestProperty("Accept-Charset","utf-8");
                   // first try to find out if the server has
                   // provided us with the charset of the response
                   // since this doesn't work with the msjvp (version 1.1.2)
                   // it's commented out
                   // instead provide a charEncoding yourselve
                   String charEncoding = "UTF8";
    //               int i = conn.getHeaderFields().size()-1;
    //               while(i>-1){
    //                    System.out.print(conn.getHeaderFieldKey(i));
    //                    System.out.print("=");
    //                    System.out.println(conn.getHeaderField(i));
    //                    if(conn.getHeaderField(i).toLowerCase().indexOf("charset")!=-1){
    //                         String charsetLine = conn.getHeaderField(i).toUpperCase();
    //                         if(charsetLine.indexOf("SHIFT_JIS")!=-1){
    //                              charEncoding = "Shift_JIS";
    //                         if(charsetLine.indexOf("EUC-JP")!=-1){
    //                              charEncoding = "EUC-JP";
    //                    i--;
                   // here is the value for char encoding (as a parameter in the <object html tag)
                   if(this.getParameter("dataCharset")!=null){
                        charEncoding=this.getParameter("dataCharset");
                   // wither you have a file or an url you read from an inputstream
                   // here is how it's done
                   // read the whole file and than turn it into a string
                   in = conn.getInputStream();
                   ByteArrayOutputStream bos = new ByteArrayOutputStream();
                   int len;
                   byte[] buf = new byte[1024];
                   while ((len = in.read(buf)) > 0) {
                        bos.write(buf, 0, len);
                   in.close();
                   // you have the file as a byte array (bos.toByteArray()
                   // here is how you turn it into a string
                   ret = new String(bos.toByteArray(),charEncoding);
              } catch (Exception e) {
                   e.printStackTrace(System.out);
              return ret;
         }

  • How the applet can access local file system?

    1. I want to plugin the applet into the JSP. That applet should access the local file system. How to enable this programmatically.
    2. Is it is possible to embed a frame inside the JSP. If so how?
    Thanks in advance..
    K G Vinoth

    1: If you want the applet to access the client's local file system you'll have to sign the applet. There is a tutorial some where on the java.sun.com that explains how to sign an applet.
    2: No you;ll need to use an applet to display swing or awt components on the client browser.

  • My Macbook Pro can't detect or read my CDFS file system external HDD

    My Macbook Pro can't detect or read my CDFS file system external HDD

    Open Disk Utility and see if the USB drives show in there. If they don't then it is a USB port or bus problem. If they do show in disk utility are they formatted in either Mac extended or a Windows format?

  • How can i open the directory/​folder and read all the files inside it in order and then close it?

    How can i open the directory/folder and read all the files inside it in order and then close it? any example would be nice.
    thanks

    In the File I/O>>Advanced File Functions Palette is a function named "List directory". This function will give you two arrays. One contains the names of all subdirectories the other the names of all files. If you want to sort them by name use the array sort function. If you want to sort them by another attribute use the File/Directory Info function to get more data. Use a cluster which contains the attribut to sort and the original index of the name. Then sort this array.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • IOS: (not) playing sound from local file system - Error #2032

    Dear all,
    I am working on an app where I want to (among others) play sound files from the local file system.
    I have added a few mp3 files into my .ipa file.
    With a small file browser in my app I can select any one of them which returns me a File object.
    I then use this File object to do a URLRequest to load the sound:
    var req:URLRequest = new URLRequest(file.nativePath);
    sound = new Sound();
    sound.addEventListener(IOErrorEvent.IO_ERROR, soundLoadError);
    sound.addEventListener(Event.COMPLETE, soundLoaded);
    sound.load(req);
    It works in flash, but fails on the iPAD. Everytime I try to load, I get a IOErrorEvent with error code Error #2032
    When I replace new URLRequest(file.nativePath) with URLRequest("http://.../testfile.mp3"), everything works fine!
    Any help appreciated.
    Is this a matter of Security settings? Can I change those?
    Something to do with Sandboxing (whatever that is)?
    or something to do with cross-domain access?
    I have been looking around for days now and any help would be appreciated!
    I am using Flash CS5.5 & AIR 2.7
    Thanks, Marcus.

    Hi Sanika,
    this was something closer to that paragraph for "nativePath":
    Some Flex APIs, such as the source property of the SWFLoader class, use a URL (the url property of a File object), not a native path (the nativePath property).
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml#nativePath
    but that is not exactly what I've read (maybe that was A-blog or post on someone from A-team on his personal blog or post on stackoverflow).
    (myself I'm using and providing solutions for paths using FILE protocol - file URI schemes - mostly whenever I can and where it is supported)
    regards,
    Peter

  • How to get folder(directory path only not file path) from local file system

    Hi Firends,
    How to get folder(directory path only not file path) from local file system , whenevr i will click on browse button.
    Please give reply for this one , if anybody knows.
    Thanks,
    Anderson.

    Hi Anderson,
    if you're using flash.filesystem.FileReference - then it is run in black box - except of filename, size and creation data (and few other properties available after some operation succeeded). This is part of security features in Flash runtime (described in header section):
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
    This for example implies that user can download a content to local machine - but that content cannot be loaded back into Flash runtime. For this you would need either Air runtime flash.filesystem.File:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml
    (so you would created Air runtime based application: desktop or mobile but not web, even as standalone project) or you would need one of 3rd party tools that add file access/file information features to standard Flash runtime applications converted to standalone native applications.
    hth,
    kind regards,
    Peter

  • Get image from local file system for printing

    If a user clicks Print, I would like to be able to print the
    stationery header if the user wants to print on plain paper. Can I
    pick up the image from the users local file system and add it
    directly to the print send object? Prior to this the user would
    simply upload the location of the image to the remote server where
    the swf resides, or do I have to ask him to upload the image itself
    and then download it again every time he uses the program?
    Doug

    Here is a snippet from the Flex 2 user guide about urlloader:
    When using this method, consider the Adobe® Flash®
    Player security model:
    For Flash Player 8 and later:
    Data loading is not allowed if the calling SWF file is in the
    local-with-file-system sandbox and the target resource is from a
    network sandbox.
    Data loading is also not allowed if the calling SWF file is
    from a network sandbox and the target resource is local.
    As far as I know there is no way for a user to "trust" an swf
    file. This is not like an activeX control.

  • [warn] mod_bonjour: Cannot read template index file '/System/Library/User Template/English.lproj/Sites/index.html'.

    Operating System: Lion 10.7.5
    I was getting this warn in the logs
    [warn] mod_bonjour: Cannot read template index file '/System/Library/User Template/English.lproj/Sites/index.html'.
    and looking to the System directory on;
    System/Library/User Template
    User Template was locked and onwned by the System.
    I went to the terminal and type;
    sudo mkdir "/System/Library/User Template/English.lproj/Sites/"
    sudo touch "/System/Library/User Template/English.lproj/Sites/index.html"
    re-started Apache
    The warn went away gracefully

    I am adding here that this seems to be a permissions bug since the "User Template" is owned by the system and no one else have access to it. The warn went away temporarily because the permissions still wrong in that directory. I changed the permissions on the User Template directory to read and see what is inside and it loops to the user system structure. Most of the directories in the system structure are locked leaving only the public and sites directory with the correct permissions. Inside of the sites folder have a blank index.html file with read access.
    So I am not sure if what I did until now will resolve the warn issue.
    What I did was to get info on the User Template directory, authenticate as root and change the permission to the admin to read only. That is harmles since not even the admin can change its content. The warn seems to have gone away for now. However, the point here is to find out if the permissions should be read and write for the admin instead of read only or some other conf. More latter!

  • Error: Failed To Read Phone's File System

    I'm using PC Suite 7.0.8.2 on XP SP3 connected to a Nokia 6300.
    I keep getting an error message when I click on Nokia Video Manager. The message states "Failed to read phone's file system. Internal error occurred". Video manager then hangs. I see it in the XP task bar but no window ever appears.
    I've tried connecting the phone via Bluetooth and USB with the same message.
    With no phone connected I should still be able to use Video Manager to convert videos and store them on my PC, but it still hangs (without the phone file system error message), so it looks like perhaps more of an issue with Video Manager than with my phone. It was working a few days ago.
    I've tried running the PC Suite installer and selecting the repair option, but that didn't help.
    Not sure what to try next. I did a search on the error message phrase in these forums but nothing turned up.
    Any ideas or suggestions?

    I have messed around and found some sort of solution.
    What seemed to be happening was the phone was creating conflicting folders on the memory card.When anew video was created the phone created a folder named video clips and stored the new video in there.
    So what I did was move all videos out of the Videos and video clips folders so that they were just on the memory card when you open it, then delete the folder named videos leaving the other video clips.
    Now when you go to video manager it can read the videos.
    However you may still get the error message but at least you can now transfer stuff.

  • What can I do when my ps3 shows the hard disk file system is corrupted and will be restored ?

    what can I do when my ps3 shows the hard disk file system is corrupted and will be restored ?
    Solved!
    Go to Solution.

    disconnect and try connecting again. use other cable.

  • [SOLVED] Find modified files from a package in local file system

    Is there a quick pacman command doing a diff between the local file system and a pacman package?
    Say I have installed a package foo and modified /etc/foo.conf. Now I want to find what's the difference between the file in my local file system and that in a clean package.
    If there's not a quick pacman command, what would you use in this case?
    Last edited by cyker (2014-10-10 05:18:46)

    amish wrote:
    Size difference does not always work!
    Lets say original conf file had two lines:
    Alert=true
    #Alert=false
    Now you changed it to:
    #Alert=true
    Alert=false
    So size will remain same!!
    So mod time is possibly better way to check!
    Right. Actually diff is the best way to check but doesn't seem to be there.

  • How to read a local file from Applet Code

    Hi
    I am developing a application and i want to access a local file from the applet
    So pls help me in coding for this

    You can't do that, at least not with an unsigned applet.
    Sign your applet and it should work just like normal file access.

Maybe you are looking for