首先找到mock-min.js 用流的形式读取
private static final String jsPath="mock-min.js ";改成如下:
private static final String jsPath;
static {
try {
jsPath = getJsPath();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
pubic static String getJsPath() throws IOException {
InputStream is = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(“mock-min.js”);
System.out.println(is);
byte[] b = new byte[10240];
int n;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
while (true) {
assert is != null;
if (!((n = is.read(b)) != -1)) break;
outputStream.write(b, 0, n);
}
is.close();
outputStream.close();
return outputStream.toString();
}
java.io.FileNotFoundException: file:\D:\workspace\file_download_demo\target\file_download_demo-0.0.1
最新推荐文章于 2024-09-30 10:36:33 发布