0
   

how to use a dynamic value for accessing a file path in java script

 
 
Reply Mon 29 Aug, 2016 12:26 pm
I have a question here, not sure where i can post it.

<pre><code>`

{
currentSuiteXlsx = new Xlsx_Reader(System.getProperty("user.dir")+ "//src//com//flipkart//xlsx//"+currentTestSuite+".xlsx");}

here "currentTestSuite" is a dynamic value gets during the run time and i want to use it.
but while executing, i am getting the below error
{
'java.io.FileNotFoundException: C:\Users\vijay gajjarapu\workspace\Core_Hybrid\src\com\flipkart\xlsx\currentTestSuite.xlsx (The system cannot find the file specified)
[email protected]

at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.flipkart.xlsx.read.Xlsx_Reader.<init>(Xlsx_Reader.java:42)
at com.flipkart.test.DriverScript.start(DriverScript.java:52)
at com.flipkart.test.DriverScript.main(DriverScript.java:25)'
}
instead of dynamic value, if am giving sheet name, my logic is working fine.
Below is the xls_Reader file function i am using:
public Xlsx_Reader(String path) {

this.path = path;
try {
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
sheet = workbook.getSheetAt(0);
fis.close();
} catch (Exception e) {
e.printStackTrace();
}

}

Please answer me.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 377 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » how to use a dynamic value for accessing a file path in java script
Copyright © 2020 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 07/08/2020 at 08:41:27