Reputation: 3351
I'm trying to save my file into a perticular directory. but i get the below Exception
Exception in thread "main" javax.xml.transform.TransformerException: java.io.FileNotFoundException: D:\News\nxis\NewFiles\I0cbf74105a2d11e5b730aca98fc673fd.nxi (The system cannot find the path specified)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at org.NXI.CreateNxi.createFiles(CreateNxi.java:49)
at org.NXI.GetInput.main(GetInput.java:24)
Caused by: java.io.FileNotFoundException: D:\News\nxis\NewFiles\I0cbf74105a2d11e5b730aca98fc673fd.nxi (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
... 4 more
---------
java.io.FileNotFoundException: D:\News\nxis\NewFiles\I0cbf74105a2d11e5b730aca98fc673fd.nxi (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at org.NXI.CreateNxi.createFiles(CreateNxi.java:49)
at org.NXI.GetInput.main(GetInput.java:24)
Here the path that is available in real is
String output = "D:\\News\\nxis\\" + replaceGuid + ".nxi";
But i'm trying to add a new folder inside it. I'm using the below command
String output = "D:\\News\\nxis\\New Folder" + replaceGuid + ".nxi";
When i run my program with the second step. It throws me an error. please let me know how can i fix it.
Thanks
Upvotes: 1
Views: 3665
Reputation: 105
Make sure that D:\News\nxis\ directory path is existing if not you have to create it.
Upvotes: 0
Reputation: 44
this will fix your problem:
new File(output).mkdir();
mkdir() creates the directory named by this abstract pathname.
Upvotes: 3