使用Inno Setup [fx:deploy] java.io.IOException本机打包fx-jar时出错

Shu*_*hra 5 java ant javafx inno-setup java-8

更新:

我发现问题是因为Inno Setup.安装程序已创建,但Inno Setup会自动尝试运行需要管理员权限的安装程序.由于未给出这些权限,因此安装程序失败.

如果我将权限授予使用Inno Setup准备的任何其他安装程序,则在提供权限几分钟后创建本机程序包.但如果我在较长时间后尝试再次发出错误.

原版的

我试图exe在eclipse中从我的JavaFX项目中打包我的文件.我使用JDK 1.8.0_25和Inno Setup 5使用build.xmlAnt脚本进行创建.

fx:deploy尝试exe使用Inno Setup 创建文件时,我的代码到达了出现此错误的部分.我的Inno安装程序位于系统路径中,当我检查任务管理器时,我看到Inno Setup实际上正在使用.

这是我得到的完整堆栈跟踪:

Using base JDK at: C:\Program Files\Java\jdk1.8.0_25\jre\..\jre
[fx:deploy] java.io.IOException: Exec failed with code 2 command [[C:\Program Files (x86)\Inno Setup 5\iscc.exe, /oE:\Code\Java\ProjectHome\build\deploy\bundles, C:\Users\SHUBHA~1\AppData\Local\Temp\fxbundler7925821782057479088\images\win-exe.image\ProjectHome.iss] in C:\Users\SHUBHA~1\AppData\Local\Temp\fxbundler7925821782057479088\images\win-exe.image
[fx:deploy]     at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:165)
[fx:deploy]     at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:138)
[fx:deploy]     at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:132)
[fx:deploy]     at com.oracle.tools.packager.windows.WinExeBundler.buildEXE(WinExeBundler.java:533)
[fx:deploy]     at com.oracle.tools.packager.windows.WinExeBundler.bundle(WinExeBundler.java:349)
[fx:deploy]     at com.oracle.tools.packager.windows.WinExeBundler.execute(WinExeBundler.java:172)
[fx:deploy]     at com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:511)
[fx:deploy]     at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:476)
[fx:deploy]     at com.sun.javafx.tools.ant.DeployFXTask.execute(DeployFXTask.java:265)
[fx:deploy]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[fx:deploy]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[fx:deploy]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[fx:deploy]     at java.lang.reflect.Method.invoke(Method.java:483)
[fx:deploy]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[fx:deploy]     at org.apache.tools.ant.Task.perform(Task.java:348)
[fx:deploy]     at org.apache.tools.ant.Target.execute(Target.java:435)
[fx:deploy]     at org.apache.tools.ant.Target.performTasks(Target.java:456)
[fx:deploy]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
[fx:deploy]     at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[fx:deploy]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[fx:deploy]     at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
[fx:deploy]     at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
[fx:deploy]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:452)
[fx:deploy]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:139)

BUILD FAILED
E:\Code\Java\ProjectHome\build\build.xml:173: Error: Bundler "EXE Installer" (exe) failed to produce a bundle.

Total time: 2 minutes 45 seconds
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙解决这个问题吗?

Jas*_*eld 2

不是这样的,你要做的就是注册ant编译器的类路径。通过以下方式执行此操作:

 1. Open Netbeans and click the Tools link at the top or press Alt-t

 2. Click options in the drop down menu from the tools or press Alt-o

 3. Click Java on the top bar, it is the Java logo

 4. Make sure you are on the ant tab, and your Ant-home has either,
    the built in Ant compiler(comes with netbeans, you do not need to set),
    or a custom one. On my computer, One virtual Machine says the Netbeans folder,
    and my Production Machine says, C:\Ant. Since I downloaded,
    and installed ant compiler myself for my production machine, more control! :D

 5. Then make sure the Verbosity Level says Normal.

 6. Then you will see a classpath box, it may be empty but should not be.

 7. For mine, I have a few JDBC connectors for my database integration,
    and the ones you need to add, which are your project you are trying
    to make the installers for. So for my project it is a timeclock manager,
    and I named it TimeClock, but I also use another project as a library in
    that project, so I have 3 things total in my Classpath.
Run Code Online (Sandbox Code Playgroud)

您需要确保为该项目添加任何包含 main 方法的包,因此我的包有 2 个(因为其中一个只是一个库)到类路径中。

 8. My Classpath looks like this

  C:\Program Files (x86)\MySQL\MySQL Connector J\mysql-connector-java-5.1.34-bin.jar
 C:\Users\{my user Name}\Documents\NetBeansProjects\TimeClock\src\JFXPrint
 C:\Users\{my user Name}\Documents\NetBeansProjects\TimeClock\src\timeclock

 9. Yours should look like this, if you only have one project
Run Code Online (Sandbox Code Playgroud)

C:\Users\{Your user Name}\Documents\NetBeansProjects\{Your Project name}\src\{Your package Name}

 9(mine). My Project name is TimeClock and My package names,
          where my main's are located are, JFXPrint and timeclock.

 10. YOUR DONE! Click Apply, Click OK, and restart the IDE. Then open it back up
     and right click the project and package as->All installers or
     whatever you want to do.
Run Code Online (Sandbox Code Playgroud)

我希望这会有所帮助,我在遇到这个问题时用谷歌搜索了这个问题,但没有人知道该怎么办。当我添加我的图标徽标时,我终于找到了它。我意识到我的类路径是空的,并仅针对一个项目修复了它,我不知道将类路径设置为所有 NetBeansProject 文件夹是否有效,但我认为这不是任何事情的好方法,全局永远不会是!由于我没有看到答案,我认为很多人都遇到了这个问题,所以我决定在找到解决方法后发布答案。

祝你好运,编程愉快!