Reputation: 79
I hope you can help me.
I make a package with the ant build tool, java 8 works fine, but with java 9 i have a exception. I do not understand why, please help me
For the installer, I use Inno Setup 5. My IDE is Eclipse Oxygen.1a Release (4.7.1a).
the exception
Buildfile: D:\Workspace BuildTest\HT .-. OE7 v2\build\build.xml
setup-staging-area:
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\externalLibs
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\externalFiles
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\project
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\projectRefs
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\externalLibs
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\externalFiles
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\project
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\projectRefs
[copy] Copying 42 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\project
do-compile:
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\build
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build\src
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build\libs
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build\classes
[copydir] DEPRECATED - The copydir task is deprecated. Use copy instead.
[copydir] Copying 1 file to D:\Workspace BuildTest\HT .-. OE7 v2\build\externalFiles
[copydir] DEPRECATED - The copydir task is deprecated. Use copy instead.
[copydir] Copying 6 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\build\libs
[copy] Copying 42 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\build\src
[copy] Copying 22 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\build\classes
[copy] Copied 14 empty directories to 3 empty directories under D:\Workspace BuildTest\HT .-. OE7 v2\build\build\classes
init-fx-tasks:
do-deploy:
[copy] Copying 1 file to D:\Workspace BuildTest\HT .-. OE7 v2\build\dist
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build \classes\META-INF
"Adding modules: [java.rmi, java.sql, javafx.web, jdk.charsets, java.logging, java.xml.crypto, java.xml, jdk.xml.dom, jdk.jfr, java.datatransfer, jdk.packager.services, jdk.httpserver, javafx.base, jdk.net, java.desktop, java.naming, javafx.controls, java.prefs, java.security.sasl, jdk.naming.rmi, jdk.zipfs, java.base, jdk.crypto.ec, jdk.management.agent, java.management, java.sql.rowset, javafx.swing, jdk.jsobject, jdk.sctp, java.smartcardio, jdk.unsupported, jdk.jdwp.agent, jdk.scripting.nashorn, java.instrument, java.security.jgss, jdk.management, java.compiler, javafx.graphics, jdk.security.auth, java.scripting, javafx.fxml, jdk.dynalink, javafx.media, jdk.accessibility, java.management.rmi, jdk.naming.dns, jdk.security.jgss, jdk.localedata] to runtime image."
[fx:deploy] java.io.IOException: Exec failed with code 2 command [[C:\Program Files (x86)\Inno Setup 5\iscc.exe, /oD:\Workspace BuildTest\HT .-. OE7 v2\build\deploy, C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss] in C:\Users\DH\AppData\Local \Temp\fxbundler15157392799151375137\images\win-exe.image
[fx:deploy] at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:169)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:142)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:136)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.buildEXE(WinExeBundler.java:703)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.bundle(WinExeBundler.java:372)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.execute(WinExeBundler.java:174)
[fx:deploy] at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:371)
[fx:deploy] at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
[fx:deploy] at com.sun.javafx.tools.ant.DeployFXTask.execute(DeployFXTask.java:310)
[fx:deploy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
[fx:deploy] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[fx:deploy] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[fx:deploy] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[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:1405)
[fx:deploy] at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
[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:1260)
[fx:deploy] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:460)
[fx:deploy] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntR unner.java:142)
BUILD FAILED
D:\Workspace BuildTest\HT .-. OE7 v2\build\build.xml:191: Error: Bundler "EXE Installer" (exe) failed to produce a bundle.
Total time: 8 seconds
What is it? I still wanted to post the build.xml, but I get this error "It looks like your post is mostly code, please add some more details."
Upvotes: 2
Views: 1685
Reputation: 1778
This is a known bug. After Java 8, the javafxpackager ant-task no longer accepts [space] characters. There is a bug report in Oracle website:
https://bugs.openjdk.java.net/browse/JDK-8202960
But it is closed as "Won't Fix". As for the explanation on why they won't fix this, I found this comment from one of Oracle engineers:
We are working on opportunity to propose some new tool to address this functionality, but it is too early to share details as this is under discussion.
So it appears that Oracle will soon retire Javafx ant-task in favor something else. But I don't know what or when :(
Update 1:
In Java 11 Oracle will retire JavaPackager but will introduce a new packager called JPackager. It will no longer include support for ant scripts; only command line. The details can be found here:
https://bugs.openjdk.java.net/browse/JDK-8200758
Update 2: As @mipa pointed out in comments, JavaPackager will be removed from Java 11 but there won't be a replacement for it until Java 12 :(
Update 3: Java 15+ now has jpackage which is much better than the old JavaPackager. It does not require ant task and very easy to use via command line.
Upvotes: 2
Reputation: 79
I found the error.
Ant creates a temporary folder in which folder the data for the package is copied and now it is crazy.
I run the script with Java 8, the file "OE 7.iss" is created.
C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss
I run the script with Java 9, the file "OE7.iss" is created, he removes the space in the program name and can not find the file
C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE7.iss
I just changed the java version, nothing else.
I was able to fix this error, I changed the program name to "OE7", but now I have new errors again
Now the package is created (with Java 9) without "OE7.iss (Inno Setup)" and external libs, when i compile it with java 8, it works fine
my build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="Build" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<property name="project.Folder" value="Build"/>
<property name="publisher" value="Indivikar AG"/>
<property name="native.Bundles" value="exe"/>
<property name="title" value="OE7"/>
<property name="version" value="1.0.0"/>
<property name="main.Class" value="application.StageStartOE7"/>
<!-- <property name="Java.Version" value="jdk1.8.0_151"/> -->
<property name="Java.Version" value="jdk-9.0.4"/>
<property name="project.Path" value="D:\Workspace BuildTest\OE7"/>
<property name="lib.Path" value="${project.Path}\lib"/>
<target name="init-fx-tasks">
<path id="fxant">
<filelist>
<file name="C:\Program Files\Java\${Java.Version}\lib\ant-javafx.jar"/>
<file name="C:\Program Files\Java\${Java.Version}\jre\lib\ext\jfxrt.jar"/>
<file name="${basedir}"/>
</filelist>
</path>
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpathref="fxant"/>
</target>
<target name="setup-staging-area">
<delete dir="externalLibs" />
<delete dir="externalFiles" />
<delete dir="project" />
<delete dir="projectRefs" />
<mkdir dir="externalLibs" />
<mkdir dir="externalFiles" />
<mkdir dir="project" />
<mkdir dir="projectRefs" />
<copy todir="project">
<fileset dir="${project.Path}">
<include name="src/**" />
</fileset>
</copy>
</target>
<target name='do-compile'>
<delete dir="build" />
<mkdir dir="build/src" />
<mkdir dir="build/libs" />
<mkdir dir="build/classes" />
<!-- Copy project-libs references -->
<copydir src="${lib.Path}"
dest="${basedir}\build\libs"
includes="**/*.jar"
excludes="**/Test.java"
/>
<copy todir="build/libs">
<fileset dir="externalLibs">
<include name="**/*.jar" />
</fileset>
</copy>
<!-- Copy project sources itself -->
<copy todir="build/src">
<fileset dir="project/src">
<include name="**/*"/>
</fileset>
</copy>
<javac includeantruntime="false" source="9" target="9" srcdir="build/src" destdir="build/classes" encoding="Cp1252">
<classpath>
<fileset dir="build/libs">
<include name="*"/>
</fileset>
</classpath>
</javac>
<!-- Copy over none Java-Files -->
<copy todir="build/classes">
<fileset dir="project/src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="do-deploy" depends="setup-staging-area, do-compile, init-fx-tasks">
<delete file="dist"/>
<delete file="deploy" />
<mkdir dir="dist" />
<mkdir dir="dist/libs" />
<copy todir="dist/libs">
<fileset dir="externalLibs">
<include name="*" />
</fileset>
</copy>
<fx:resources id="appRes">
<fx:fileset dir="dist" includes="${project.Folder}.jar"/>
<fx:fileset dir="dist" includes="libs/*"/>
<fx:fileset dir="dist" includes="resources/**"/>
</fx:resources>
<fx:application id="fxApplication"
name="${title}"
mainClass="${main.Class}"
version="${version}"
/>
<mkdir dir="build/classes/META-INF" />
<fx:jar destfile="dist/Build.jar">
<fx:application refid="fxApplication"/>
<fileset dir="build/classes">
</fileset>
<fx:resources refid="appRes"/>
<manifest>
<attribute name="Implementation-Vendor" value="${publisher}"/>
<attribute name="Implementation-Title" value="${title}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="JavaFX-Feature-Proxy" value="None"/>
</manifest>
</fx:jar>
<mkdir dir="deploy" />
<fx:deploy
embedJNLP="false"
extension="false"
includeDT="false"
offlineAllowed="true"
outdir="${basedir}/deploy"
outfile="Build" nativeBundles="${native.Bundles}"
updatemode="background"
verbose="true" >
<fx:info title="Build" vendor="${publisher}"/>
<fx:application refId="fxApplication"/>
<fx:resources refid="appRes"/>
</fx:deploy>
</target>
</project>
if I know more, I will contact you again
Upvotes: 3
Reputation: 19107
You have this line in your log:
[fx:deploy] java.io.IOException: Exec failed with code 2 command [[C:\Program Files (x86)\Inno Setup 5\iscc.exe, /oD:\Workspace BuildTest\HT .-. OE7 v2\build\deploy, C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss]
Now, I would say you have some problems with that line of code.
C:\Program Files (x86)
Does the path really have two spaces? Shouldn't it be:
C:\Program Files (x86)
Inno Setup 5\iscc.exe,
What is that comma at the end? Shouldn't it be:
Inno Setup 5\iscc.exe
/oD:\Workspace BuildTest\HT .-. OE7 v2\build\deploy
Your path has spaces in it. It is a very weird path and I might even be wrong. Only you can confirm. But you need quotes. Something like:
/o"D:\Workspace BuildTest\HT .-. OE7 v2\build\deploy"
, C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss
Again, you have a comma at the start, and you are not wrapping the path to the script file in quotes. Something like:
"C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss"
So, putting it all together:
C:\Program Files (x86)\Inno Setup 5\iscc.exe /o"D:\Workspace BuildTest\HT .-. OE7 v2\build\deploy" "C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss"
So:
" ... "
around your paths since they have spaces.The help for ISCC provides more details.
Upvotes: 1