Wednesday, November 12, 2014

Selenium : Eclipse (java) relative path

Eclipse (java) relative path



Example  1:
String filePath = ".\\images\\NotSet_16x16.png";

Example 2 :
If I have a project with following structure and want to reach excel file "excel.xls" as below .


Project_test
        |
        |
         --- src
            |
            |
             ---com (this is a package)
                |
                |
                ---    library (this is a package)
                    |
                    |
                    ---excel.xls



Path=".\\src\\com\\library\\excel.xls"


where «.\» is a root for Eclipse project, «images» is a folder with user's files inside of Eclipse project. Since we are talking about Windows OS, we have to use «\» and not «/», like in Linux, but «\» is the reserved symbol, so we have to type «\» to get desired result.

No comments:

Post a Comment