How to save files in the filesystem and remember their position?

This is a fairly novice question. I'm writing a Java desktop application which executed from the jar (actually a jnlp) will first run a setup creating some files in a directory of user choice.
When the application runs, it'll requires access to those files. However, if they were not saved in the user home directory, how could the application know where they are located? I hope the problem is clear enough. I cannot permanently save the user choice of location at setup time other than in the user home directory, but then I'd rather just save the files there. The problem is that in my case the user has no writing permissions to the user directory.

simpatico_gabriele wrote:
I'll need to look closer at your demo and the API. However from what you suggest it seems my application could still run in the sandbox (without being signed) and access the database without bothering the user (if he chooses always allow the first time). True?No. The PS can be accessed sand-boxed, so you can get the path to the DB in a sandboxed app., but the DB itself will require all-permissions to access. (Actually there are some pure Java DBs that can be launched from sand-boxed code, from classes on the run-time classpath, and so long as the app. does not need to change the data - that would be OK.)
It is true that the JNLP API provides sand-boxed access to the local file system, but it does so through a FileContents object, a strictly limited type of File that is not usable in exchange for a method that accepts (for e.g.) a File or URL.
If so, I still have a concern: the application also needs to store an image in a folder the user can reach. Writes to the image occur frequently. So using just the PersistService (as in ur demo) wouldn't do since it would be cached somewhere not chosen by the user (and hardly reachable anyway).
I could use the ExtensionInstallerService to store along the db this image in the same path, and then write to it in the same way as I do with the db. However, will I need to offer a JFileChooser twice, once for each file,.. I don't understand why. The EIS determines the path for the DB using a JFileChooser, then stores it in the PS. The app. gets the path to the DB and image folder, from the PS.
If they are to be stored in the same path, why is there a need to show 2 file choosers?

Similar Messages

  • How to write files to the filesystem with portal/plsql

    Hi,
    is there a way to write files to the filesystem via Portal?
    Or can i call an external programm (perl, php) to do so, while portal writes further information to database?
    thank you for the help
    Ralf Schmitt

    Hi Ralf,
    my primary task is to publish download-links to files stored ... somewhere as a linklist. I tried to store and download files to/from the database but i cant get it to run. Upload works, download doesn't.
    (i'm not talking about a single form-query-download-link! I need a report-like linklist)If you want to do this you'll have to write some code but sure it's possible - i did it myself.
    The links in the link list in your report should call a stored function retrieving the files from Wwdoc_document or whatever is the document table defined in your DAD. Simply select BLOB_CONTENT into a BLOB variable from the table, provided you know what file to read :-) The function would then read the BLOBs and send them to the client's browser via DBMS_LOB - it's poor design but it works just as smooth as it could and it's really performing. This would simply display the file into your browser or prompt for file save location, depending on what browser you are using and its client settings.
    I guess this is not so clear, if you want some more details feel free to e-mail me at [email protected]
    Another way would be to use wpg_docload to both download and upload files to/from the DB.
    Now i try to figure out if it is possible to store the files to the filesystem and write only additional info like description or path into db.Again, yes, it is. I can't recall exactly how I did it ^_^ but the trick is to create a virtual directory in the DB - pointing at a physical directory on the file system you want to write to, and you have to have full read-write permission on the directory itself, and its path must be included in the utl_file_dir database parameter. Then you use both COM Automation or UTL_FILE to write files.
    would it be possible to let a portal-form write info to the db and then pass the file to a php-script?
    regards,
    Ralf Schmitt

  • How can I re-arrange the pages in a Pages document now?? I used to be able to click on the thumbnails and shift their position which is important in creating documents.  Any ideas?

    How can I re-arrange the pages in a Pages document now?? I used to be able to click on the thumbnails and shift their position which is important in creating documents.  Any ideas?

    This feature has been removed from Pages 5 along with over 90 others:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&mforum=iworktipsn trick
    Pages '09 is still in your Applications/iWork folder.
    Trash/archive Pages 5 and rate/review it in the App Store.
    Peter

  • How to save file with the "/" symbol in the name?

    Hi,
    I have Adobe Professional 8.  I need to save files with names that include the symbol /, but Adobe interprets, for example, A/88/6, as file name 6, in a folder named 88, in a folder named A, and sets up new folders to accommodate that.  I cannot substitute another symbol as I already have thousands of pdf files in a database using the / symbol, and I need them in the same folders.
    I would very greatly appreciate any advice,
    thanks,
    Mo.

    Thanks.
    As I said, I'm pretty ignorant about these things.  I wouldn't know how to begin using a "hack".  All I know is that I was able, for over a year, to save .pdf files directly from my browser on several computers, and use the forbidden "/" symbol in every file name.  After saving the files, Adobe will happily open them, and allow me to edit and re-save them, although I now see that it will not allow me to "save as" them under a different name without removing that symbol.
    I may not be tech-savvy, but I can state that everything I have said here and above is entirely accurate.  I would be happy to open a dropbox account to show you countless .pdfs with the symbol "/" in the name.
    This is honestly not that big a deal.  I greatly appreciate this discussion, and you have inspired me to become slightly less computer-ignorant.
    Hope you all had a great New Year.  I am still recovering.
    Cheers,
    Mo.

  • How to synchronize files in the iFS and a record of table ?

    I have table that contains information about a documents. Document's name, author, project number, etc... Documents are files made by Word or Autocad etc.. Documents are saved in the iFS.
    One record in the table should correspond one document in the iFS.
    Do somebody know how can I syncronice the Table and iFS so, that if someone add's (or delete) a file to the iFS, that reflects to the table too ? This mean that a record should be added to the table.
    Do I need some special column in the record that points to document ?
    Thanks,
    Antti

    A better solution is to use iFS metadata to store your additional properties, instead of using a custom table. You could create a Document subclass with additional attributes, your you could attach a Category with the additional attributes to Documents in iFS. Then you could use the iFS API to get and set these attributes and they would be stored, managed, and exposed as part of the iFS content management.

  • How to save files on the server?

    I want to save a log on the server, how can I do this using Oracle?
    In SQL Server I used the "bcp" command.
    Thanks.

    as forbrich suggested you can use the UTL_FILE built-in package. here is an example code to read and write to a file.
    CREATE OR REPLACE PROCEDURE Read_Write_File (pvInFile Varchar2,
                                                 pOutFile Varchar2) IS
    vInFile   utl_file.file_type;
    vOutFile  utl_file.file_type;
    vNewLine  VARCHAR2(4000);
    x         PLS_INTEGER;
    vFlag  BOOLEAN := TRUE;
    BEGIN
      -- assuming Your_Directory is $HOME/myTxtFiles in a Unix Platform
      -- to check if definition is existing Select Directory_Name, Directory_Path From All_Directories;
      vInFile := utl_file.fopen('Your_Directory',pInFile,'r');
      vOutFile := utl_file.fopen('Your_Directory',pOutFile, 'w');
      IF utl_file.is_open(vInFile) THEN
        LOOP
          BEGIN
            utl_file.get_line(vInFile, vNewLine);
            x := utl_file.fgetpos(vInFile);
            dbms_output.put_line(TO_CHAR(x));
            utl_file.put_line(vOutFile, vNewLine, FALSE);
            utl_file.fflush(vOutFile);
            IF vFlag = TRUE THEN
              utl_file.fseek(vInFile, NULL, -30);
              vFlag := FALSE;
            END IF;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN
              EXIT;
          END;
        END LOOP;
        COMMIT;
      END IF;
      utl_file.fclose(vInFile);
      utl_file.fclose(vOutFile);
    EXCEPTION
      WHEN others THEN
        RAISE_APPLICATION_ERROR (-20099, 'Unknown UTL_FILE Error');
    END;
    /

  • Computer died - how to save files from the iphone?

    My computer died and my iPhone holds all my music and photos. I know how to restore purchasemusic and save Camera Roll photos, but I also have old music that I burned from CDs and photos that are synced with My Photos. Does anyone know have any ideas?

    http://www.wideanglesoftware.com/touchcopy/index.php  PC and Mac versions
    http://www.ecamm.com/mac/phoneview/  Mac only

  • How to save files into the application directory

    In Struts..i am using FileWriter to create a new file in struts..
    What path name shd be given for it be saved in Webapps/Application directory?

    You should get the context path first,then you can construct a absolute path for you destination file.To get the context path by the following way:
    public class TestInServlet extends HttpServlet{
         public void doPost(HttpServletRequest req,HttpServletResponse res){
                                               //The getRealPath() is deprecated.
              String ctxPath = req.getContextPath();
    }Regards,
    mauvespan

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • Since upgrading to Lion, i am unable to take screen shots.  i get the message that i don't have permission to save files to the place where SSs are saved.  how can i regain the ability to save screen shots?  thanks

    since upgrading to Lion, i am unable to take screen shots.  i get the message that i don't have permission to save files to the place where SSs are saved.  how can i regain the ability to save screen shots?  thanks

    First of all, are you using the OS native screen capture?
    If not, make sure the application you're using has been update for Lion.  I was using Snapz Pro for years, but I need to update it for use with Lion. Meanwhile Grab and the keyboard shortcuts are working on my Lion load.
    If you are using the native capture mode unsuccessfully, I would run the Disk Utility and repair permissions on the drive. For some reason, even in past OS Versions, routine maintenance of permissions makes life a lot easier.

  • Is there a way to open Excell file from the server and display in the UI and save it back on to the

    Hello there,
    Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)

    Hi Mike,
    Welcome you to the forum.
    You may try:
    SELECT * FROM MyDBNameHere.dbo.OUSR T0
    Thanks,
    Gordon

  • When trying to upload a PDF to an interactive site I get the announcement:"The attached PDF file references a non-embedded font Tahoma. Please remove file, embed the font and reattach." How do I embed this, or in fact any other font ?

    When trying to upload a PDF to an interactive site I get the announcement: "The attached PDF file references a non-embedded font Tahoma. Please remove file, embed the font and reattach."
    I could not get rid of the Tahoma font in the WORD file.
    How do I embed this, or in fact any other font ?

    Thank you very much !
    Indeed, I was unaware of the enormous number of options that can be selected when converting a WORD file to PDF.
    I went thru the settings and found the right one for embedding the fonts.
    Thanks again !
    Oren

  • How to open a file, change the name and write file

    Hi,
    I want to open an existing .dat-file in Labview, manipulate the data and save this data into a new file with a different file name.
    Though the name should be different I would like to use the old name and add something to it.
    (In my programm the .dat file containes the date and time the data was
    measured and I would like to keep this information in the filename.)
    For example: the original title is file1.dat now I want to save it as file1_manipulated.dat
    Is that possible? What is the best and easiest way to do it?
    Thanks a lot
    Chris

    Hi Mike,
    thanks for your help.
    This will give me my path in string format. But to open a new file and then write my data into it, I need a path format (see right side of png)
    Is that right?
    I attached a png, so you hopefully get an idea where this is going. (I know this won´t work yet)
    I open a file and this filename depends on the date and time the data was recorded. So I can´t work with a stringconstant.
    Sorry for this beginner questions - this stuff is absolutly new to me.
    Thanks in advance
    Chris
    Attachments:
    newfile.png ‏11 KB

  • I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?

    I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?
    Many thanks for any advice.
    David

    You don't need conversion programs, iTunes can copy most of your content over to the iPad via the file sharing section, and some apps also support Dropbox, email attachments, transfer via your wifi network. There are a number of apps that you can get that support Microsoft office file (microsoft don't make an app versions of their software) e.g. from Apple there are Pages (word support), Numbers (excel) and Keynote (powerpoint), and from third-parties there are apps such as Documents To Go and QuickOffice HD

  • How to cluster the war file conatining the jsp and servlet by using wl6.0sp1?

    There three wlsever6.0 sp1.
              One is admin server and doesn't join the cluster.
              Two servers are cluster server.
              I use the admin console to deploy the war file and the war file conatains
              the jsp and servlet.
              How to config the one of the clustered servers as the primary one, so that
              the client can request the jsp?
              If the one of the clustered servers is closed, can the client be redirected
              to another clustered server?
              Does the proxy server need to be exist?
              

    There three wlsever6.0 sp1.
              One is admin server and doesn't join the cluster.
              Two servers are cluster server.
              I use the admin console to deploy the war file and the war file conatains
              the jsp and servlet.
              How to config the one of the clustered servers as the primary one, so that
              the client can request the jsp?
              If the one of the clustered servers is closed, can the client be redirected
              to another clustered server?
              Does the proxy server need to be exist?
              

Maybe you are looking for