cancel
Showing results for 
Search instead for 
Did you mean: 

file path from the server isn't work

Former Member
0 Kudos

I want to create a barcode on pdf and i use jasper file to create the pdf ,

There is parts of my code :

String getUrl=this.getClass().getResource("PartsPDFBarcodeLable.jrxml").getFile(); 
byte[] bytPDF = new byte[0];
if (FL.exists())// template file exist
{
      bytPDF = getPDFBytes(getUrl, arrayData);
      throw new RuntimeException("FL.exist = true and url = " + getUrl);
}
return bytPDF;

getUrl result is file:/D:/usr/sap/J2E/JC00/j2ee/cluster/server0/bin/ext/tsmc.compartsvendorservlibj2elib/tsmc.compartsvendorbeanjava~barcodeAssembly.jar!/com/tsmc/parts/nw/component/utils/PartsPDFBarcodeLable.jrxml

the problem is FL.exist() always return false

how can i solve the problem??

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Plz look at the below thread

Answers (2)

Answers (2)

Former Member
0 Kudos

thanks for your answer.

i found the problem is that the path is too long so i move the file on to other directory and its worked

thank you

Former Member
0 Kudos

Hi,

Try this code

String resourcePath;
	String path;
String str6=str10+str11+str7+str8+str9+".txt";//file name
File file=new File(str6);
resourcePath =
					  WDURLGenerator.getResourcePath(
						wdComponentAPI.getDeployableObjectPart(),
						str6);
			 path = file.getAbsolutePath();resourcePath =
					  WDURLGenerator.getResourcePath(
						wdComponentAPI.getDeployableObjectPart(),
						str6);
			 path = file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess("File path"+path);

This code to print the path of the file on screen when u run application.

Regards,

H.V.Swathi