cancel
Showing results for 
Search instead for 
Did you mean: 

File not found exception

Former Member
0 Kudos

Dear All,

I am trying to open a file which is located at

src/mimes/Components/com.sap.tut.wd.uploaddownloadinteractiveform.UploadDownloadInteractiveFormComp,

I am using this sample code given by sap..

*

IWDAttributeInfo attInfo =

wdContext.currentContextElement().node().getNodeInfo().

getAttribute("PdfSource");

ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();

IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) type;

binaryType.setFileName("TravelRequest.pdf"); // Set file name

binaryType.setMimeType(WDWebResourceType.PDF); // set the mime type

String fileName ="temp
webdynpro
web
local
TutWD_UploadDownloadInteractiveForm_Init
Components
com.sap.tut.wd.uploaddownloadinteractiveform.UploadDownloadInteractiveFormComp1
TravelRequest.pdf";

// path to the source file

/* converts the binary file to a byte array and moves it to the text element */

try

{

File file = new File(fileName);

FileInputStream in = new FileInputStream(file);

ByteArrayOutputStream out = new ByteArrayOutputStream();

int length;

byte[] part = new byte [10 * 1024];

while ((length = in.read(part)) != -1)

{

out.write(part, 0, length);

}

in.close();

wdContext.currentContextElement().

setPdfSource(out.toByteArray());

} catch(Exception e)

{

throw new WDRuntimeException(e);

}

*

But I am getting runtime exception...

java.io.FileNotFoundException: temp\webdynpro\web\local\TutWD_UploadDownloadInteractiveForm_Init\Components\com.sap.tut.wd.uploaddownloadinteractiveform.UploadDownloadInteractiveFormComp1\TravelRequest.pdf (The system cannot find the path specified)

Please tell me what could be the reason...

Thanks in Advance

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Amit/Arafat,

I am facing the same issue. I have given the complete path of where the file resides but it stills throws the same error -

java.io.FileNotFoundException: D:\Documents and Settings\divya.rao\Documents\SAP\workspace\NghiaDemo\src\mimes\Components\adobe.sap.com.Test\TraveRequest.pdf (No such file or directory)

How can I resolve this?

Many thanks,

Divya

Former Member
0 Kudos

Hi Amit,

Try to give fully qualified name alongwith the local disk drive. like "c:\temp\abc\def.pdf".

Hope this helps!!

Regards,

Arafat