我创建了将project / src / drivers文件夹中的exe文件复制到项目文件夹的项目。 代码:
public static void main(String[] args) throws Exception {
FileInputStream fis = new FileInputStream("src\\drivers\\test.exe");
BufferedInputStream bis = new BufferedInputStream(fis);
FileOutputStream fos = new FileOutputStream(".\\test2.exe");
BufferedOutputStream bos = new BufferedOutputStream(fos);
int b = 0;
while ((b = bis.read()) != -1) {
bos.write(b);
}
fos.flush();
fos.close();
但是当我创建可执行jar时,我收到此错误:
Exception in thread "main" java.io.FileNotFoundException: src\drivers\test.exe (The system cannot find the path specified)
为什么系统无法在jar中找到我的exe文件?如何导航到jar中的驱动程序文件夹?
这是我在winrar中打开的jar文件:http://imgur.com/wTa302f