0 Replies Latest reply on Jul 29, 2013 9:20 AM by user541023 - oracle

    Cannot Compare two files(any type) in openscript

    user541023 - oracle


      I'm trying to compare two excel sheets using open-script. I wrote the following code


      File file1 = new File(

        "C:\\Users\\hnariset\\DDownloads\\OATS Downloads\\Plan_V_Actual_Summary_-_Platform.xls");

        File file2 = new File(

        "C:\\Users\\hnariset\\DDownloads\\OATS Downloads\\Plan_V_Actual_Summary_-_Platform(1).xls");

        boolean filesSame = FileUtils.contentEquals(file1, file2);

      if (filesSame) {

        JOptionPane.showMessageDialog(null, "Files have same contents.");


        } else {

        JOptionPane.showMessageDialog(null,"Files have different contents.");




      But this is giving me (filesSame=) false always,even if the two files are same.(I made a copy of one sheet manually in the folder and compared the two).This is happening for every type of file.


      I tried to see the error and printed the differences.The problem,I found, is in reading the files.It's reading in some language I can't understand.

      How to rectify this error using the same function or write a new function to know exactly the error(read in normal language)??