• Community
  • Questions
  • java code to export file from java application which is deployed in Unix Server to windows PC

java code to export file from java application which is deployed in Unix Server to windows PC

I have a java application which I runs as expected on localhost (Windows 7). Basically the purpose of this application is to pull the data from database and display's on screen, if user wants this content to export it to his local machine then he can export it. This working as expected from my local machine (windows 7). After deploying the WAR file in Unix server and run it, then it is looking for location that I gave, it's not downloading the file. Here is the exception that I'm getting...

Error while generating report: C:/ArchieveTool/ArchieveTool/output/02012014020842.xls (No such file or directory)


at java.io.File.<init>(File.java:277)

at com.sw.sirax.process.MainServlet.exportFile(Unknown Source)

at com.sw.sirax.process.MainServlet.doPost(Unknown Source)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:205)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

Here is the piece of code that I'm using to export the file:

enter code here

public String createExcelReport(DataHelper helper) throws Exception{


Workbook wb = new HSSFWorkbook();

setCellData(helper, wb);

SimpleDateFormat format = new SimpleDateFormat("MMddyyyyhhmmss");

String filePath = "C:/ArchieveTool/ArchieveTool/output/" + System.getProperty("file.separator") + "ArchiveUtility_" + format.format(new Date()) + ".xls";

FileOutputStream stream = new FileOutputStream(filePath);




return filePath;


private String generateReport(DataHelper helper){

String filePath = null;


ExcelGenerator generator = new ExcelGenerator();

filePath = generator.createExcelReport(helper);

}catch(Exception ex){

logger.severe("Error while generating report: " + ex.getMessage());


return filePath;


Please let me know what to change in the code If I need to download that file to downloads folder in win 7 from application which is running on UNIX server...

please someone assist me here.

1 answer

0 vote

Could you explain what this has to do with Atlassian products?

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

285 views 38 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot