Results 1 to 6 of 6
  1. #1
    yezrach is offline Member
    Join Date
    May 2015
    Posts
    2
    Rep Power
    0

    Default list of files is different between system where it supposed to be the same!!!

    Hi,

    I am running short code which will list files in specific directory on few systems which supposed to be look-alike (files cksum is the same).
    I would expect to have the next order:
    1. CustomizationMapping.xml
    2. CustomizationMapping.VVM.xml
    3. CustomizationMapping.VW.xml

    BUT WHATEVER I AM DOING I CANT HAVE SYSTEM-A TO BE THE SAME AS SYSTEM-B


    system A:
    # /usr/java/jre1.6/bin/java -classpath /var/tmp/findFiles.jar main
    running
    /usr/cti/conf/compas/common/parameters.xml
    /usr/cti/conf/compas/common/contract.xml_forDebugOnly
    /usr/cti/conf/compas/common/CustomizationMapping.VVM.xml
    /usr/cti/conf/compas/common/CustomizationMapping.xml
    /usr/cti/conf/compas/common/CustomizationMapping.VW.xml
    /usr/cti/conf/compas/common/ErrorDescriptionMapping.xml

    system B:
    # /usr/java/jre1.6/bin/java -classpath /var/tmp/findFiles.jar main
    running
    /usr/cti/conf/compas/common/contract.xml_forDebugOnly
    /usr/cti/conf/compas/common/ErrorDescriptionMapping.xml
    /usr/cti/conf/compas/common/parameters.xml
    /usr/cti/conf/compas/common/CustomizationMapping.xml
    /usr/cti/conf/compas/common/CustomizationMapping.VVM.xml
    /usr/cti/conf/compas/common/CustomizationMapping.VW.xml

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: list of files is different between system where it supposed to be the same!!!

    Okay, you've shown you have a problem. Good luck with that!

    If you ever want help to solve it, feel free to actually post the code you currently have. I do wonder: why is the order of the files important if you only want to compare for equality? I'd think you only want to check if the same files exist in both directories, and that the checksum of each individual file is the same.
    Last edited by gimbal2; 05-18-2015 at 10:44 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: list of files is different between system where it supposed to be the same!!!

    I would expect to have the next order:
    1. CustomizationMapping.xml
    2. CustomizationMapping.VVM.xml
    3. CustomizationMapping.VW.xml
    You might want to explain the previous expectation. If for example you are using a Map, the order may not be the same. It all depends on your code (which as stated is missing). A Short, Self Contained, Correct Example would help (<= 100 lines or so).

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    yezrach is offline Member
    Join Date
    May 2015
    Posts
    2
    Rep Power
    0

    Default Re: list of files is different between system where it supposed to be the same!!!

    Quote Originally Posted by jim829 View Post
    You might want to explain the previous expectation. If for example you are using a Map, the order may not be the same. It all depends on your code (which as stated is missing). A Short, Self Contained, Correct Example would help (<= 100 lines or so).

    Regards,
    Jim
    Hi,

    basically I've created short program to list the actual files in certain directory.

    i think its some where in the system level and how the java code or even linux find command print the list of files in a different order.


    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub

    System.out.println("running");

    File myDir = new File("/usr/cti/conf/compas/common/");

    File[] ListFiles= myDir.listFiles();
    for (int i =0 ;i<ListFiles.length;i++)
    {
    File curr_file = ListFiles[i];
    System.out.println(curr_file.getAbsolutePath());
    }

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: list of files is different between system where it supposed to be the same!!!

    SYSTEM-A TO BE THE SAME AS SYSTEM-B
    Why do you think the two systems should have files on their disks in the same order?
    What are the dates (creation or last modified) associated with the files on each of the two systems?
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: list of files is different between system where it supposed to be the same!!!

    From the documentation on the File class for method listFiles():

    "There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order."

    And if you take a look at the source code for the method, it ultimately depends on the default file system of the OS for retrieving the files.


    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Help making a Menu system for Student List System
    By jason3460 in forum New To Java
    Replies: 0
    Last Post: 12-09-2012, 01:39 PM
  2. Replies: 4
    Last Post: 03-10-2009, 06:31 AM
  3. List of System properties
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-29-2007, 04:56 PM
  4. Replies: 2
    Last Post: 08-07-2007, 07:22 PM
  5. Replies: 1
    Last Post: 07-27-2007, 05:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •