satmisha
asked on
what is the way to get get path dynamically as I am getting Getting java.io.FilenotFoundException while using FileStream
Hi Experts,
I am trying to read text file which works great on my local but when I deploy it on server it creates problem because the path on server is different as that of my local.
My Local Path:
C:\Folder1\Project\File.tx t
Server Path:
C:\F1\F2\F3\F4\Project\Fil e.txt
So in code I have used like this:
Java.IO.FileINputStream.op en + new FileInputStream("./Project /File.txt" )
It works great on my local but fails when I deploy it on server, reason is path.
Is there any way I could make it dynamic so that it could itself detect the right path ?
Looking forward to hearing from you.
I am trying to read text file which works great on my local but when I deploy it on server it creates problem because the path on server is different as that of my local.
My Local Path:
C:\Folder1\Project\File.tx
Server Path:
C:\F1\F2\F3\F4\Project\Fil
So in code I have used like this:
Java.IO.FileINputStream.op
It works great on my local but fails when I deploy it on server, reason is path.
Is there any way I could make it dynamic so that it could itself detect the right path ?
Looking forward to hearing from you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Apologies for late response. Thanks a lot for your help.
You're welcome!
java -Dmypath=C:\Folder1\Projec
Or pass in the path as an argument to your program.
java MyProgram C:\Folder1\Project\ MyProgram