Relative Filepath

Hi, i have a folder structure like this:
-root
-- data
-- images
in data i'm going to store some files that will contain some text. I'm trying to open them in a java source file in the root. How can i open them using a relative filepath (ie something like "\\data\data.dat") rather than a direct one (ie "c:\work\java\data\data.dat")?
clarkie

Thankyou, i think this should work now, but i'm
getting this error:
Main.java [31:1] cannot resolve symbol
symbol : constructor File (java.net.URL)
location: class java.io.File
File dataFile = new File(filePath);
i imported java.net.URL. is that right? or should i
import something else?
thanks again,
clarkieOops - that's what I get for not having the API memorized. There is a File(URI) constructor, but not File(URL).
Actually what I'd do is to rewrite your loadDataFile method to either take a URL (instead of a File) parameter or an InputStream.
To open the data as an InputStream:
InputStream inStream = getClass().getResourceAsStream("/data/java.dat");
Or if you already have the URL to it via getClass().getResource("/data/java.dat") then you can open that stream via the URL's openStream() method.

Similar Messages

  • How to get a relative filepath using Java?

    Hi,
    I'd like to write a custom application for something I'm doing at work. Basically, I need to find the relative filepath from one file to another. Like, if I start in a subdirectory of directory A with file abc.htm, I want to use Java find the relative hyperlink I would put in abc.htm to link to another file in another subdirectory of A. Something like "../Subdirectory/xyz.htm" (where xyz.htm is the file I want to link to) returned as a string.
    The reason it needs to be a relative filepath without any references to named directories is that the application with all the hyperlinks in it will eventually reside on a different server or servers. The people who put it there will maintain the same directory structure as we have in our development directory, however.
    So, anyway, I see in the File class you have methods for getting absolute filepaths and directory names and such, but nothing for getting a relative link to another file.
    Does anyone know if such a class/method exists anywhere in std Java? Or how else I could go about doing this?
    Many thanks if you can help.

    Given a File object f then one can build the path to the root as a list of file names from f.getName() and iterating using f = f.getParentFile().
    Once you have the path lists for your two files then it is simple enough to find the branch point by moving forward through the lists until values differ. Building the relative path is then a matter of moving back through one using "../" until the branch point and then forward through the other until you reach the last element.

  • Opening files via relative filepaths

    Hello everyone,
    I've got a small problem with publishing a Captivate 3.0.1
    project as an EXE file. The presentation ends with two buttons, one
    opens a website (works fine), and the other should open a PDF file.
    It also works OK, but only if I use an absolute path, which is
    unacceptable in this situation - I need a _relative_ path.
    I tried various possible ways to write the relative filepath
    (file:///file.pdf, /file.pdf, ./file.pdf, .\file.pdf, iexplore
    file.pdf, etc) but to no avail - the result is always the same. IE
    opens with the filepath bluntly inserted into it's address bar, and
    fails to open it (no wonder -
    http://file.pdf is a bogus address,
    wouldn't you know...).
    I've also tried some other workarounds - creating an .swf
    file, that would open the .pdf for me, and then embedding it inside
    the presentation. Works fine until embedded; from within the
    project, it acts exactly the same. I also couldn't get JavaScript
    to work.
    Do you have any solution for this problem? It would be very
    helpful.
    What's interesting, if I publish as .swf+.html, the
    pdf-opening button works fine, but the website-opening button
    doesnt. I didnt look into this very much, since I'm only interested
    in an executable version. However... if making the .swf version
    work is a lot simpler, I can wrap it up in an executable of my own
    devising. Perhaps that will make more sense.
    Looking forward to your replies,
    Szymon Kurek

    Welcome to our community, Szymon
    See if the thread linked below helps with that.
    Click
    here to read the thread
    Cheers... Rick

  • Is there a way to tell the dir location of a class?

    Good day.
    I have a desktop application and I want it to save information to files located in the directory where the class is started.
    example...
    c:\myStuff\java java -jar myJar.jarThe program starts but is there a way within the program to tell where it started from, the mystuff\java location.
    I have listed all of the system properties but thay all reference the location of the java executable?
    Any ideas?
    Thanks.

    hmmm... I'm not sure how you can get the exact filepath where it's running, but it seems like if you only want to save stuff there to just make your files with relative filepaths/names rather than absolute filepaths. On that note (come to think of it) you could make a file with a relative filename and then call "getAbsolutePath()" on that file (of course that would be answering the question after solving the problem)

  • How can I save a website   and keep all assets attached without loss

    Hi there
    I have constructed my first website using Dreamweaver with five tabbed pages. When I preview in Safari everything is there and it all works seemlessly. When I then try to save it on my mac to user - web - sites - site when I launch the page on my domain I get the background and text and a few Gifs but most of the other gifs and the navigation buttons are missing. I am very much the newbie but feel I am a few strands of knowledge short of making this work.
    Very frustrating. Can you please help?
    Andy

    First thing I'd check is to see if your links to those assets are relative to the document as opposed to relative to your hard drive!
    An example: Let's say your site is in a folder called "MyWebsite". Within that folder you have a folder called "images" with your images, a folder called "style" with your CSS and finally all of your HTML pages lie singly within the "MyWebsite" root.
    To call your CSS you would point links this way "../style/MyStyleSheet.css" - where ".." = root folder (MyWebsite), "/style" = the folder called "style", and "MyStyleSheet.css" = your style sheet.
    Your links to images would look like, "../images/ImageName.jpg" - again the "dot dot" points to the root folder ("MyWebsite"), "/images" then directs it to the folder called "images" and the "ImageName.jpg" would be the actual image that is linked.
    Following relative filepaths (relative to the "root" folder) will ensure that regardless of where you move the "MyWebsite" folder, all the links will continue to work.
    If this does not answer your problem, please post a URL to the site so we can look at your code and perhaps provide more in-depth answers.

  • Scripting help for image pop-up within a PDF

    Hi,
    I'm creating some sample eBooks in Acrobat Professional 9 (Mac), and I am stuck on one element that needs to be present. In the text within the PDF, there might be a phrase like, "See Fig. 1". Fig. 1 might not be on that page, however. I know how to create a link in a PDF that will navigate the reader to the page with the image referenced, but that's not good enough. I'd like to have this happen:
    User clicks on "See Fig. 1".
    Popup window appears with the referenced thumbnail image.
    The image's popup window will stay on-screen until dismissed by the user.
    Clicking on the popup thumbnail image calls up a full-size image.
    The added wrinkles are many after we figure out the scripting for the above, but here are two major ones to be addressed right away:
    1) The images are already part of the typeset document converted to PDF, so I am guessing the images would have to be bundled with the PDF somehow. Our users need to use the PDFs in an offline environment, so a call-out to a URL is out of the question.
    2) The PDFs will be read on Macs, PCs, and possibly iPads. If a bundled, local file is called out when a user clicks on "See Fig. 1", how do I set a relative filepath in the call-out?
    Thanks for any help you can provide.
    Andrew

    Here's a sample document that demonstrates some of what you're asking about: https://acrobat.com/#d=aP-2xL45pM57xVkT6d6fSg
    The images are stored in buttons, so there is no concern about having to use external images. Note that this may not work on an iPad since most (all?) PDF viewers on the iPad do not have JavaScript support.

  • LR4: Issues with "Export as Catalog"

    I'm preparing my Windows  LR 4.2 installation for a significant computer rebuild. Naturally I need to be able to 'save/restore' all my catalogs, some of which are not small. Having copies of his LR2 and LR4 books for Digital Photographers, I followed the technique recommended by Scott Kelby (which is also the subject of an FAQ on this forum). Aside from the assertation that it doesn't take long (for me, it did) the export of previews, database and negatives from all folders in each catalog, to a USB attached disk, worked ok.  Except that...
    1. In trying to understand why it was so slow I looked at the structure of the exported 'file' for my largest catalog on the external drive. It seemed to be a simple copy of the .lrdata set of many preview folders plus the .lrcat folder plus the original negatives in their original folder structure. Before attempting to prove this is the case, by repeating this process using Windows Explorer file utilties, I decided to compare the original files/folders with the copies that 'export as catalog' had made. I used 'Beyond Compare' for this (a product which, in my opinion, is exactly that: beyond compare). The results were very disconcerting:
    1.1 Out of the hundreds of preview folders, in the .lrdata collection, there was not 1 single identical compare of combined folder and file in the copy. There were folders in the original which did not appear in the copy. Even worse, there were folders in the copy that did not appear in the original (explain that!). In those very few cases where there was a folder match, the enclosed .lrprev file did not match in either file name or file size. In other words the original and copy were completely different.
    Is this as one should expect?
    1.2 Overall the original .lrcat and .lrdata objects differed in size and date/time to the copy, with the originals being larger and dated/timed later than the copy, even though I had performed no library or development operation on the catalog, aside from closing it (which initated an automatic backup). What additional information has been added to the catalog after I copied it, and by whom?
    2. On one catalog the export process repored that it could find no preview data for any of the photos, even though it shows them to me when I open the catalog. In addition, the original .lrdata folder is far larger than the exported copy of that folder - 599MB versus 3MB. So the preview data is definitely there in the originals. Why wasn't it exported?
    Overall, the comparison using Beyond Compare suggests to me that a simple file copy of the catalogs and images should work - and it will certainly ensure that originals and copies are identical. Can this process be used to ensure that a valid catalog set will be produced for the subsequent 'restore' step?

    Yes, you can simply copy the whole lot and it will function the same in the new location, provided the same image files (or equivalent copies thereof) are available to the Catalog at the same filepaths in both places. I believe the previews are found using a relative filepath starting from wherever the Catalog now finds itself. So the relative arrangement needs to be preserved. Or, if previews are not copied over, the Catalog still works fine, and will generate previews automatically as you go thereafter.
    It may not be necessary to have Develop previews for every single image in the Library right at the start - remembering that previews for less recently edited images will have by default cleared themselves anyway, after a certain period.
    If the image filepaths are going to be different in some systematic way - different drive letter, different folder location - then it is easy to update LR's internal records about that; for example, through a single operation on the parent folder, one can re-address an entire tree of subfolders and their contents at the same time.
    As a database, one would expect a fresh copy written-out by Export to be optimised in terms of how the data is stored (disk block level) and also that it would be free of any accumulated redundancy (e.g., records and related indexing for items that are marked for deletion but still physically present). Perhaps this would be exactly the same as a database that had just been optimised by LR, perhaps not - the point of Export as Catalog is that this is NOT a whole-database operation, it is a SELECTIVE operation, based on whatever images have been highlighted. So the result is not necessarily ever going to be identical.
    The previews folders are not intended to be human-readable, and can IMO be therefore thought of in the same functional terms - this effectively constitutes a second database. When previews are included in an Export, this is a second brand new structure being created, even if some of the data within that is a straight transfer.

  • Speeding up playback

    Other than using proxies or bringing in rendered sections of the node tree what are the best ways of speeding up playback?
    Oh, and I'm having trouble losing the links to files when I move a project.
    I've tried changing the environment variables and Shakes project now picks up the correct location but not the links.

    Relative paths are +relative to the location of the shake script.+
    In other words, if you're starting from scratch, you need to save
    the script with or near the media before you can use relative paths.
    In my workflow, I usually keep Shake scripts in the same directory
    as the media. By using relative filepaths, I can move the whole
    directory and everything will work.
    The important thing is whether +FileIn's imageName parameter+
    is the full path or the relative path. Typically, I'll just edit the imageName
    so that only ./ and the file name remain.
    There is a shortcut. In the FileIn browser, if you
    enable the browser to accept relative file paths (icon)
    and
    uncheck "show full path" (checkbox)
    then you can type in the file name, starting with ./
    and the resulting FileIn node is created with the relative filepath.
    In this mode, you can also click on the file in the browser,
    and add the ./ in front of the name.
    So that technique can save you some time.
    More details on this subject are available in the Shake manual.
    Check out page 40 and page 112.

  • Import existing HTML Help project

    New to RoboHelp 9 (sigh) - trying to import an existing hhp project but I get the message that the hha file contains an incorrect filepath. Nothing has changed regarding relative filepaths. What am I overlooking?

    Hi DorrianneG and welcome to the RH forums.
    I'm afraid a .hha file is a new one on me. Isn't this some sort of archive file? Do you actually have a .hha file present from where you are importing? Also can I ask why you are trying to open a project from the HHP file? There are implications of doing this. Do you not have access to the other project source files?

  • Actual and relative file paths - CS4(mac)

    Is there a way to save your file so that it ALWAYS looks for the relative paths of all its content?
    My issue is that when i xfer the prproj file to another computer it asks me to reconnect everything. The other computer has exactly the same folder structure as the one i'm copying from minus a different harddrive name. (I just copied and pasted the whole project from computer to computer).
    Its really getting to become a huge hassle....any work around and whatnot would be great....thanks!

    I deal with this often (yesterday in fact). Things get ugly when you try to re-link a project that has media placed in multiple folders within the main project folder. Even worse when there are a hundred cryptically named P2 mxf files.
    Try this:
    Open the *.prproj file in Notepad and do an "Edit" "Find" for the word: filepath
    Keep searching down till you get a drive letter.
    This will show the original drive letter the project was last saved with.
    To save time, and avoid relinking everything, do one of the following two... your choice:
    1.) Do a find and replace in Notepad of a short "phrase" of code containing the original drive letter, in the document. Replace it with the identical phrase containing the currently assigned drive letter.
    For Example:
    Find: <FilePath>E:\
    Replace With: <FilePath>G:\
    OR:
    2.) After noting the original drive letter in the *.prproj file by doing the "filepath" search in Notepad, simply assign the original drive letter back to the drive in "Computer Management"/"Storage"/Disk Management.
    *WARNING: Premiere is unforgiving of even the slightest error in a *.prproj file.
    ALWAYS EDIT A COPY OF YOUR PROJECT IN NOTEPAD

  • Filepath

    Hey,
    My last problem using a filechooser lead me into a bunch of related trouble. I wrote this demo to ask - just run the proggy and you'll see.
    I got a problem concatenating a path to a folder with a filename.
    I got a problem putting "/" in the end of a folder path name.
    I got a problem with the "folders only" option for the JFileChooser on Linux.
    thx, in advance!!!
    package filepath;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.WindowConstants;
    public class PathFrame extends javax.swing.JFrame {
         private JLabel lbPathByTF;
         private JTextField tfPath;
         private JPanel panSetUpFolderPath;
         private JPanel panFiles;
         private JLabel lbFileName2;
         private JLabel lbFileName1;
         private JLabel lbPathByButton;
         private JButton butPath;
         // Filenames
         private String szFileA = "FileA.txt";
         private String szFileB = "FileB.txt";
         private File folder;
         * Auto-generated main method to display this JFrame
         public static void main(String[] args) {
              PathFrame inst = new PathFrame();
              inst.setVisible(true);
         public PathFrame() {
              super();
              init();
          * inits & grafical mess
         private void init(){
              folder = new File("");
              initGUI();
              initAL();
         private void initGUI() {
              try {
                   GridBagLayout thisLayout = new GridBagLayout();
                   thisLayout.rowWeights = new double[] {0.0,0.0,0.1,0.0,0.0};
                   thisLayout.rowHeights = new int[] {7,7,20,20,7};
                   thisLayout.columnWeights = new double[] {0.0,0.1,0.0};
                   thisLayout.columnWidths = new int[] {7,7,7};
                   getContentPane().setLayout(thisLayout);
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                   this.setResizable(false);
                        panFiles = new JPanel();
                        GridBagLayout panFilesLayout = new GridBagLayout();
                        panFilesLayout.rowWeights = new double[] {0.1,0.0,0.1};
                        panFilesLayout.rowHeights = new int[] {7,7,7};
                        panFilesLayout.columnWeights = new double[] {0.1};
                        panFilesLayout.columnWidths = new int[] {7};
                        panFiles.setLayout(panFilesLayout);
                        getContentPane().add(panFiles, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                        panFiles.setBorder(BorderFactory.createTitledBorder("  resulting file paths are now:  "));
                             lbFileName1 = new JLabel();
                             panFiles.add(lbFileName1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                             lbFileName1.setText("my file A");
                             lbFileName1.setPreferredSize(new java.awt.Dimension(350, 22));
                             lbFileName2 = new JLabel();
                             panFiles.add(lbFileName2, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                             lbFileName2.setText("my file B");
                             lbFileName2.setPreferredSize(new java.awt.Dimension(350, 22));
                        panSetUpFolderPath = new JPanel();
                        GridBagLayout panSetUpFolderPathLayout = new GridBagLayout();
                        panSetUpFolderPathLayout.rowWeights = new double[] {0.1,0.0,0.0,0.1,0.1};
                        panSetUpFolderPathLayout.rowHeights = new int[] {7,7,7,7,20};
                        panSetUpFolderPathLayout.columnWeights = new double[] {0.0,0.1};
                        panSetUpFolderPathLayout.columnWidths = new int[] {7,7};
                        panSetUpFolderPath.setLayout(panSetUpFolderPathLayout);
                        getContentPane().add(panSetUpFolderPath, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                        panSetUpFolderPath.setBorder(BorderFactory.createTitledBorder("  Set up the path to to a folder:  "));
                             tfPath = new JTextField();
                             panSetUpFolderPath.add(tfPath, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                             tfPath.setText("my path");
                             tfPath.setPreferredSize(new java.awt.Dimension(350, 22));
                             butPath = new JButton();
                             panSetUpFolderPath.add(butPath, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                             butPath.setText("browse");
                             butPath.setPreferredSize(new java.awt.Dimension(100, 22));
                             lbPathByTF = new JLabel();
                             panSetUpFolderPath.add(lbPathByTF, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                             lbPathByTF.setText("my path");
                             lbPathByTF.setPreferredSize(new java.awt.Dimension(350, 22));
                             lbPathByButton = new JLabel();
                             panSetUpFolderPath.add(lbPathByButton, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                             lbPathByButton.setText("my path");
                             lbPathByButton.setPreferredSize(new java.awt.Dimension(350, 22));
                   pack();
                   setSize(400, 300);
              } catch (Exception e) {
                   e.printStackTrace();
         private void initAL(){
              butPath.addActionListener( new ActionListener(){
                   public void actionPerformed( ActionEvent ae){
                        choose();
              tfPath.addActionListener( new ActionListener(){
                   public void actionPerformed( ActionEvent ae){
                        getPath();
          * actions
          * implements a filechooser to find the folder
         private void choose(){
              JFileChooser fc;
             fc = new JFileChooser(folder.getAbsoluteFile());
              int hInput = fc.showOpenDialog(this);
              if( hInput == JFileChooser.APPROVE_OPTION){
                   fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );
    //               fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                    * Problem: selecting folders doesn't work!
                    * If I select a folder and click on the open button of the
                    * filechooser it just opens but not selected!?
                   if(fc.getSelectedFile().exists()){
                        folder = fc.getSelectedFile();
                   }else{
                        folder = new File("");
              lbPathByButton.setText( folder.getAbsolutePath());
              refreshFilePaths();
          * takes the path to a folder directly from the <CODE>JTextField</CODE>
         private void getPath(){
              folder = new File(tfPath.getText());
               * Problem: I always obtain the path without "/" or "\" at the end. Thus concatenating
               *           this path with some file name will lead to something odd.
               *           e.g. /mnt/datasettings.xml and not /mnt/data/settings.xml like it should.
               * Problem: Even if I add a "/" in the textfield it just won't take it? It takes "\" but no "/"
               *           at the End. (I'm working on Debian/Linux hence I need "/").
              lbPathByTF.setText( folder.getAbsolutePath());
              refreshFilePaths();
          * basic access
         private void refreshFilePaths(){
              lbFileName1.setText( folder.getAbsolutePath() + szFileA);
              lbFileName2.setText(folder.getAbsolutePath() + szFileB);
    }

    1)
    these
    private String szFileA = "FileA.txt";
    private String szFileB = "FileB.txt";
    should be
    private String szFileA = "\\FileA.txt";
    private String szFileB = "\\FileB.txt";
    2)
    you're setting the selection mode after the chooser is visible
    fc = new JFileChooser(folder.getAbsoluteFile());
    int hInput = fc.showOpenDialog(this);
    if( hInput == JFileChooser.APPROVE_OPTION){
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );//fc is already showing???
    should be
    fc = new JFileChooser(folder.getAbsoluteFile());
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );//<-----move to here
    int hInput = fc.showOpenDialog(this);
    if( hInput == JFileChooser.APPROVE_OPTION){
    //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );//<----moved

  • How to let java auto discern file type and use related software to open

    thanks

    sorry;
    I am making a program about searching file;
    when this program achieve searching;the result(all files that Fulfiling requirements ) will be shown in JTable;when user click a cell that include fileName;program will produce a object like
    File f=new File(filepath);
    I dont kown what this files type will be,so I hope java can auto discern file and use related software to open(like windows open file with related software)

  • Site-Wide Error Handler Filepath

    My error handler page is located at C:\Inetpub\wwwroot\portal\error_handler.cfm but cfadmin (for CF 8) wants a relative path.  I've tried:
    C:\Inetpub\wwwroot\portal\error_handler.cfm
    Inetpub\wwwroot\portal\error_handler.cfm
    wwwroot\portal\error_handler.cfm
    portal\error_handler.cfm
    error_handler.cfm
    and http://www.hostname.com/portal/error_handler.cfm
    Each time is says the specified file does not exist.
    What should the filepath be relative to?
    Thanks!

    It has to be relative to a ColdFusion mapping OR the ColdFusion web root.  The latter has always been the most reliable for me.
    It is a little known feature of ColdFusion that it often has two web roots for which it will search for cfml templates.  The web root defined for the web server such as c:\inetpub\wwwroot\ that you apparently have.  But before searching the web server web root it will search the ColdFusion web root, that on my multi-home flavor of ColdFusion is c:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\.  It is this latter directory that I put my site wide error and missing template handler fiels.  Then I just place the file names in the appropiate fields in the administrator.
    If you have a default backslash (\) mapping to your web root defined in the ColdFusion administrator, you should be able to input something like "\portal\error_handler.cfm" but I have always had difficulty getting this way to work.

  • Cf9 - flex - orm updating entity with a relation

    Hello,
    I'm trying to update a cf9 orm entity with a one-to-many relation defined as follow:
    Articles
    property name="ArticleID" column="ArticleID" type="numeric" ormtype="int" fieldtype="id" default="0" generator="identity" unsavedvalue="0";
    property name="ModelName" column="ModelName" type="string" ormtype="string" ;
    property name="Description" column="Descrption" type="string" ormtype="string" ;
    property name="ArticleImages" type="array" fieldtype="one-to-many" cfc="Images" fkcolumn="ArticleID" fetch="join" remotingfetch="true" cascade="all-delete-orphan";                       
    Images
    property name="ArticleImageID" column="ArticleImageID" type="numeric" ormtype="int" fieldtype="id" generator="identity" default="0" unsavedvalue="0";
    property name="ArticleID" column="ArticleID" type="numeric" ormtype="int"; 
    property name="FilePath" column="FilePath" type="string" ormtype="string";
    Everything works fine if I update (entitysave) Articles by a coldFusion page.
    If I try by a Flex app using remoteObject all records are written with right values but I receive a fault event with a message which say the ArticleID of the table Images can't contain a Null value.
    In fact in the database the ArticleID field is right updated but I don't know why I receive always the same error.
    The remote object mapping seems to be right established.
    I'm testing with a SQL2008R2 database and all the tables have an IDENTITY primary key field.
    Does anybody have experienced this situation ?
    How can I solve this problem ?
    Thanks,
    Daive

    Did you have tried "entitymerge" instead of "entitysave" ?

  • Get application filepath

    Hello,
    Is it possible and how to get the full filepath of a currently running Java application?
    something analogous to $0 in a UNIX script?
    I have searched hard for this one and haven't found anything.
    Thanks, Allasso

    Allasso wrote:
    pbrockway2 wrote:
    A single executable jar is good. If you put the things you are copying within the jar archive you can access them as getResource("/dir/whatever.dat"). The leading slash means the name will be resolved from the top of the jar archive. Basically this means you don't have to dick around with the URL returned for your class to figure out the paths to the resources. Moreover since the classpath is being used to resolve whatever.dat's name the mechanism is location agnostic the way Andrew described.assuming then, that the URL returned would be the absolute path in relation to the user's machine, then it sounds like that would work good. If I am understanding you correctly then, I could just put the location of the parent folder of the files I am copying as the arg to getResource() and get right to it.
    ThanksI was referring to the case of a "single executable jar" - if you put the installer and the resources it uses all inside the same jar then getResource() can be used in a straight forward fashion with the argument being the path (within the jar) to the executable.

Maybe you are looking for