我正在尝试使用JAVA将Excel从本地复制到pjt工作区。
我的代码是:
public void copy(String filepath,String newFilePath) throws IOException
{File oldFile = new File(filepath);
File newFile = new File(newFilePath);
try{
FileUtils.copyFileToDirectory(oldFile, newFile);
}
文件路径是: C:\fakepath\exceldata.xls(file path)
newFilePath是:(D:/Workspace/Pjt/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bench/files/2013-10-16
它在我的Eclipse工作区中的目录)
当我的tomcat服务器和文件位于同一台计算机上时,它可以正常工作。但是,当我尝试从另一台计算机上载文件时,则无法正常工作。
在这种情况下,我收到找不到源文件的错误(FILE NOT FOUND EXCEPTION
。)
请帮助我...任何帮助,我们将不胜感激。谢谢..
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句