I have a java file which uses XSL file to perform transformation. Code used is:
FileInputStream inXLSFile = new FileInputStream("ListApi.xsl");
TransformerFactory factory = TransformerFactory.newInstance(); StreamSource xslStream = new StreamSource(inXLSFile); After this a jar file is generated. from the jar file I am not able to use the XSL. It says 'File not found'. Please give pointers.
change
FileInputStream inXLSFile = new FileInputStream("ListApi.xsl");
to
InputStream inXLSFile = this.getClass().getResourceAsStream("ListApi.xsl");
for more information read about how do I load a file from a jar?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.