You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在VS Code中安装JavaFX时遇ZipException错误求助

解决VS Code创建JavaFX项目时的ZipException错误

错误信息

Executing task: ""c:\Users\User-name.vscode\extensions\vscjava.vscode-maven-0.44.0\resources\maven-wrapper\mvnw.cmd"" org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeArtifactId="javafx-archetype-fxml" -DarchetypeGroupId="org.openjfx" -DarchetypeVersion="RELEASE" -DgroupId="com.example" -DartifactId="demo" -DoutputDirectory="c:\Users\User-name\Desktop\JavaProject""

Exception in thread "main" java.util.zip.ZipException: zip END header not found
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1649)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1657)
at java.base/java.util.zip.ZipFile$Source.(ZipFile.java:1495)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1458)
at java.base/java.util.zip.ZipFile$CleanableResource.(ZipFile.java:724)
at java.base/java.util.zip.ZipFile.(ZipFile.java:251)
at java.base/java.util.zip.ZipFile.(ZipFile.java:180)
at java.base/java.util.zip.ZipFile.(ZipFile.java:194)
at org.apache.maven.wrapper.Installer.unzip(Installer.java:169)
at org.apache.maven.wrapper.Installer.createDist(Installer.java:86)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:121)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)

问题原因

Maven wrapper自动下载的Maven压缩包损坏,导致解压时无法识别zip文件的结束标识。

解决步骤

  • 找到Maven wrapper缓存目录:C:\Users\User-name\.m2\wrapper\dists,删除该目录下所有文件夹。
  • 回到VS Code重新执行JavaFX项目创建操作,让Maven wrapper重新下载完整的Maven压缩包。
  • 若重新下载仍失败,可手动下载对应版本的Maven压缩包(如apache-maven-xxx-bin.zip)放到上述dists目录;或直接在VS Code设置中搜索maven.executable.path,指定本地已安装Maven的mvn.exe路径,跳过Maven wrapper的使用。

内容的提问来源于stack exchange,提问作者tanvir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 10:25:06