Closed outcast292 closed 4 years ago
To create an image for a different platform, you need to download and unpack a JDK for the target platform (in your case, a 32bit JDK for Windows). Then, in the jlink
block you call one of the targetPlatform methods, specifying the path to the JDK for your target platform. For example:
jlink {
...
targetPlatform('win32', 'C:/Downloads/jdk-13.0.2+8')
...
}
I'm not familiar with the POSReady systems, so I'm curious if the produced image works on this platform. Looking forward to your feedback.
@siordache , the image of some console based projects worked well in my POSReady systems. the only problem is for a JavaFX project,i ve been trying to deploy for both 32 and 64 bits architectures, Whenever i start the JLinkTask i get this:
Error: jlink version 13.0 does not match target java.base version 11.0
even if i changed the JVM to 11 in both Intellij , and Gradle my Build.gradle
jlink {
...
targetPlatform('win64', 'C:\\Program Files\\Java\\jdk-11x64')
targetPlatform('win32', 'C:\\Program Files\\Java\\jdk-11x32')
...
jpackage {
jpackageHome = 'C:\\Program Files\\Java\\jdk-14'
installerOptions = ['--win-menu', '--win-shortcut', '--win-per-user-install', '--win-dir-chooser']
skipInstaller = false
imageName = 'Treporteur Generator'
installerName = 'Treporteur Generator'
installerType = 'msi'
imageOptions += ['--icon', 'src/main/resources/img/favicon.ico'] // <- Here
}
}
PS: JPackage does not use my specified icon , even if i add the ImageOptions Line Appreciate your help
It seems that although you run Gradle with Java 11, the plugin still uses jlink version 13 to build the runtime images. You can see which jlink executable the plugin uses, if you run Gradle with the --info flag:
gradlew --info clean jlink
The ouptut will contain something like this:
Starting process 'command 'C:\Program Files\Java\jdk-13.0.1+9/bin/jlink.exe''.
Working directory: <path-to-your-project>
Command: C:\Program Files\Java\jdk-13.0.1+9/bin/jlink.exe
-v --strip-debug --compress 2 --no-header-files --no-man-pages
--module-path C:\\Program Files\\Java\\jdk-11x32/jmods/;<path-to-your-project>\build\jlinkbase\jlinkjars
--add-modules ...
--output ...
The plugin still uses jlink version 13 because it evaluates the javaHome property to determine the path to the JDK tools (javac, jar, jlink etc.) it uses. If this property is not set, the path to the JDK tools is the first non-empty value from:
badass.jlink.java.home
system propertyBADASS_JLINK_JAVA_HOME
environment variablejava.home
system property (only if it points to a JRE containing the javac, jar, and jlink tools)JAVA_HOME
environment variableOne way to make your build work is to set the javaHome
property:
jlink {
...
javaHome = 'C:\\Program Files\\Java\\jdk-11'
...
}
Concerning the icon issue, I see two possibilities:
jpackage cannot find the icon file. In this case, Gradle issues the following warning:
> Task :jpackageImage
...
The specified icon "src\main\resources\img\favicon.ico" is not an ICO file and will not be used. The default icon will be used in its place.
jpackage actually uses your icon, but Windows displays it incorrectly (for example, it displays the previous default icon) due to icon cache problems. A reboot may solve this issue, but you can also refresh the icon cache as described here or here.
i tried giving an non existing icon as option to imageOptions to see if it raises an exception , but it didn't which made me believe that the imageOptions aren't passed to the JPackage .
also the generated installers are 64bit . and i m wondering if there s a way to get around this issue
@siordache really thankful for your help .
jpackage doesn't generate an exception if the icon is missing. It prints a warning, but it still creates the package.
You can use gradlew -i jpackage
to see the actual jpackage commands executed by the plugin. You should find one jpackage issued by the jpackageImage
task and one issued by the jpackage
task. The jpackage command of the jpackageImage
task is the one that should contain the --icon
option.
You can also inspect the build\jpackage\Treporteur Generator\Treporteur Generator.ico
. Be sure to open it with Paint (or other graphics editor), because the Windows Explorer may show you a false image due to icon cache issues.
--
In contrast to jlink, jpackage cannot generate installers for other platforms. To create a 32bit installer for Windows, you need to execute jpackage on a Windows 32bit machine. That's why the plugin does not have an option to automate the creation of installers for multiple platforms.
i understand , i m really thankful for your help , the runtime is working fine on the POSReady system . keep the nice work
So i m trying to develop for a pos machine . Which only support 32 bit . It s using posready 7 ( which is about to get discontinued). And i want to know if there's s any possibility to create the runtime with 32bit support or just target a specified architecture in the build process.. Ps: i m using jdk13 . Windows 64 bits