- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
今天我在导出后遇到问题(我使用的是 ecplise)(我的应用程序在导出之前有效,但在导出之后无效)
错误屏幕:https://image.noelshack.com/fichiers/2019/33/4/1565884882-capture.png
我尝试使用其他库处理选项导出,它给了我同样的错误,但有更多错误:
错误屏幕:https://image.noelshack.com/fichiers/2019/33/4/1565885180-capture.png
这是我的启动方法所在的类:
package com.bleu.application;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class Bleu {
public static void launch() throws IOException, URISyntaxException {
File Bleu = new File("C:\\temp\\Bleu.exe");
URL url = Bleu.class.getResource("Bleu.exe");
Path source = Paths.get(url.toURI());
Files.copy(source, Bleu.toPath());
}
}
还有主类
package com.bleu;
import java.io.IOException;
import java.net.URISyntaxException;
import com.bleu.application.Bleu;
import com.bleu.bootstrap.bootstrap;
public class Main {
public static void main(String[] args) throws IOException, URISyntaxException {
Checker.deleteExists();
bootstrap.update();
Bleu.launch();
}
}
最佳答案
永远不要假设资源是常规文件。如果资源位于 .jar 文件内,则它只是压缩字节的子序列,而不是真正的文件。
不要尝试将资源视为路径,而是将其作为输入流获取,然后复制该输入流:
Path bleu = Paths.get("C:\\temp\\Bleu.exe");
try (InputStream source = Bleu.class.getResourceAsStream("Bleu.exe")) {
Files.copy(source, bleu);
}
关于java - 导出后出现 FileSystemNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57512801/
今天我在导出后遇到问题(我使用的是 ecplise)(我的应用程序在导出之前有效,但在导出之后无效) 错误屏幕:https://image.noelshack.com/fichiers/2019/33
我在以下代码中遇到此错误(请注意,这不会发生在我的本地机器上,只会发生在我的构建服务器上): Files.readAllBytes(Paths.get(getClass().getResource("
我有一个 Maven 项目,在一个方法中,我想在我的资源文件夹中创建一个目录的路径。这样做是这样的: try { final URI uri = getClass().getResource(
我正在尝试在 Docker 容器内运行的 Spring Boot 应用程序中加载文件,但出现以下异常: java.nio.file.FileSystemNotFoundException at co
由于未正确找到文件路径,我收到此异常报告。 Caused by: java.nio.file.FileSystemNotFoundException: Provider "wsjar" not ins
我构建了一个相当大的 JavaFX 应用程序(JAR 大约 128 MB)并且通过 IntelliJ 运行没有问题。但是当我从终端运行它时,我的 3D 模型加载器(Fxyz3d 库)会启动此异常。 E
我在我的项目中添加了 graal 库以在 Java 中执行 JavaScript。我的项目在 spingboot 框架上工作。 compile group: 'org.graalvm.sdk', na
在尝试使用我的 java 应用程序将我的 jar 文件中的一些文件复制到临时目录时,抛出以下异常: java.nio.file.FileSystemNotFoundException at c
我是一名优秀的程序员,十分优秀!