【Mac环境·java】如何设置读取文件路径
使用惯win电脑在转换mac之时😇原地上天,这里和大家分享一下如何设置读取文件路径
直接拖拽文件到终端,获取相关文件路径
直接将所展示的文件路径复制使用即可
代码实例
package com.j.poi;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Created by jdx on 2022/3/23 上午9:50
*/
public class CreateSheetPage {
public static void main(String[] args) throws IOException {
FileInputStream in = new FileInputStream("/Users/jdxml/Documents/poi.xls");
FileOutputStream out = new FileOutputStream("/Users/jdxml/Documents/test/poi.xls");
/*定义*/
int length;
byte[] bys = new byte[1024];
while((length = in.read(bys)) != -1) {
out.write(bys, 0, length);
}
in.close();
out.close();
}