Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

UPDATE:

I figured out that the problem is because of the Inno Setup. The installer is getting created but Inno Setup automatically tries to run the installer for which admin permissions are required. Since these permissions are not given hence the installer fails.

If I give the permission to any other installer prepared using Inno Setup then the native package is created after a few mins of giving the permissions. But if I try after a longer time it again gives the error.

Original

I am trying to package my exe file from my JavaFX project in eclipse. I am using JDK 1.8.0_25 and Inno Setup 5 for the creation using the build.xml Ant script.

My code reaches the fx:deploy part where I get this error while trying to create the exe file using Inno Setup. My Inno Setup is in the system path and when I check the task manager I see the Inno Setup actually being used.

Here is the full stack trace I get:

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

Can anyone help with this issue?

like image 989
Shubhanshu Mishra Avatar asked Nov 01 '22 11:11

Shubhanshu Mishra


1 Answers

That is not it, What you have to do is register the classpath of the ant compiler. Do this by:

 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.

You want to make sure to add any packages for that project, that have a main method in them, so mine has 2, since one is just a library, to the classpath.

 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.

I hope this helps, I googled this issue when I was having it, and no one knows what to do. I finally found it, when I added my Icon logo. I realized my classpath was empty and fixed it for just the one project, I don't know if it works to set the Classpath to all of the NetBeansProject folder, but I don't think that is a good way for anything, Globals never are! Since I saw no answers, I figured many people were having this issue, so I decided to post the answer once I found out how to fix it.

Good Luck and Happy Programming !

like image 64
Jason Brumfield Avatar answered Nov 15 '22 04:11

Jason Brumfield