簡體   English   中英

使用Inno Setup [fx:deploy] java.io.IOException本機打包fx-jar時出錯

[英]Error while native packaging fx-jar using Inno Setup [fx:deploy] java.io.IOException

更新:

我發現問題是因為Inno Setup。 安裝程序已創建,但Inno Setup會自動嘗試運行需要管理員權限的安裝程序。 由於未給出這些權限,因此安裝程序失敗。

如果我將權限授予使用Inno Setup准備的任何其他安裝程序,則在提供權限幾分鍾后創建本機程序包。 但如果我在較長時間后嘗試再次發出錯誤。

原版的

我試圖在eclipse中從我的JavaFX項目中打包我的exe文件。 我正在使用JDK 1.8.0_25和Inno Setup 5來使用build.xml Ant腳本進行創建。

我的代碼到達fx:deploy部分,我在嘗試使用Inno Setup創建exe文件時出現此錯誤。 我的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

有人可以幫忙解決這個問題嗎?

那不是它,你需要做的是注冊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.

你想確保為該項目添加任何包,其中包含一個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

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.

我希望這有幫助,當我擁有它時,我用Google搜索了這個問題,沒有人知道該怎么做。 當我添加我的Icon徽標時,我終於找到了它。 我意識到我的類路徑是空的並且只為一個項目修復它,我不知道它是否能夠將Classpath設置為所有NetBeansProject文件夾,但我不認為這是一個很好的方法, Globals從不是 由於我沒有看到答案,我想很多人都有這個問題,所以一旦我發現如何修復它,我決定發布答案。

祝你好運,快樂編程!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM