Closed mristuccia closed 4 years ago
Okay, I fixed the 3) by adding an "export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" to the startup script. My application uses a library which needs to call an executable installed under /usr/local/bin. And it seems that the library calls it without using the full path.
With point 1) and 3) fixed my application bundle runs like a charm. I would kindly suggest you to fix point 1) for sure, and maybe point 3) as well by grabbing and injecting somehow the user's default $PATH. My full startup script is now as follows:
#!/bin/sh
# Mac OS X startup script generated by JavaPackager Maven Plugin
SCRIPTPATH=`cd "$(dirname "$0")" ; pwd`
JAVA=`/usr/libexec/java_home`/bin/java
BINARY=$SCRIPTPATH/../Resources/Java/phPatcher-1.0-SNAPSHOT-runnable.jar
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
$JAVA -Dapple.laf.useScreenMenuBar=true -Xdock:name=phPatcher -Xdock:icon=$SCRIPTPATH/../Resources/phPatcher.icns -jar $BINARY $@
Hi Marco,
thanks for trying JavaPackager and your contribution and feedback. I'm a Windows user, sorry for \r\n
in MacOS script file, I didn't notice it. I'll try to fix points 1 and 3 asap. About point 2, I used MacOS Sierra 10.12 and OpenJDK 11, and it worked fine, but I'll try with JDK 13.
Please, can you share your plugin config?
Hi Fran,
thanks for the support. Here follows my plugin config in pom.xml with "bundleJre" set tu true. That's what triggers the problem in point 2:
<plugin>
<groupId>fvarrui.maven</groupId>
<artifactId>javapackager</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<mainClass>com.marcoristuccia.phpatcher.phPatcher</mainClass>
<displayName>phPatcher</displayName>
<organizationName>Marco Ristuccia</organizationName>
<organizationUrl>http://www.marcoristuccia.com/it</organizationUrl>
<bundleJre>true</bundleJre>
<jrePath>/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home</jrePath>
<forceJreOptimization>false</forceJreOptimization>
<administratorRequired>false</administratorRequired>
<additionalResources>
<param>/usr/local/bin/exiftool</param>
</additionalResources>
<generateInstaller>true</generateInstaller>
</configuration>
</execution>
</executions>
</plugin>
Hi Marco,
please, try to remove jrePath
option from the plugin configuration. This option was added for those JDKs that do not include the jlink
tool, and you are using JDK 13. If you ommit this option, JavaPackager uses jlink
to generate a customized and reduced JRE, including only those modules used by your app. With jrePath
you are bundling your full JDK, and maybe it can't be code signed.
Let me know if this solved your problem.
Realeased v0.8.6 with points 1 and 3 fixed. Please, confirm that issues are really solved. If not, reopen this issue and I'll look for a new solution.
Thank you Fran! Will try soon the 0.8.6.
In the meantime I tried a run by removing the jrePath
as you said.
Now I get this strange error:
Creating runnable JAR...
Building jar: /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar
[info] Copying resource [/mac/default-icon.icns] to file [/Users/marco/Developer/phPatcher/target/assets/phPatcher.icns]
[info] Copying stream to file [/Users/marco/Developer/phPatcher/target/assets/phPatcher.icns]
Creating Mac OS X app bundle...
Creating and setting up the bundle directories
Creating startup file
Copying icon file to Resources folder
[info] Copying file [/Users/marco/Developer/phPatcher/target/assets/phPatcher.icns] to folder [/Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources]
Copying dependencies to Java folder
Copying all dependencies to app folder ...
Copying exiftool-lib-2.5.0.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/exiftool-lib-2.5.0.jar
Copying opencsv-5.0.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/opencsv-5.0.jar
Copying commons-lang3-3.9.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-lang3-3.9.jar
Copying commons-text-1.7.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-text-1.7.jar
Copying commons-beanutils-1.9.4.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-beanutils-1.9.4.jar
Copying commons-logging-1.2.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-logging-1.2.jar
Copying commons-collections-3.2.2.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-collections-3.2.2.jar
Copying commons-collections4-4.4.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-collections4-4.4.jar
Copying darcula-2018.2.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/darcula-2018.2.jar
Copying annotations-16.0.1.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/annotations-16.0.1.jar
Copying commons-io-2.6.jar to /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-io-2.6.jar
[info] Copying file [/Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar] to folder [/Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java]
Bundling JRE ... with /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
- Creating customized JRE ...
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jdeps -q --ignore-missing-deps --list-deps --multi-release 13 /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar
[info] Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar
[info] java.base
[info] java.desktop
[info] java.logging
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jlink --module-path /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/jmods --add-modules Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar,java.base,java.desktop,java.logging --output /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home --no-header-files --no-man-pages --strip-debug --compress=2
[info] Error: Module Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar not found
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 5.659 s
Finished at: 2020-01-08T12:48:14+01:00
Final Memory: 28M/114M
------------------------------------------------------------------------
Failed to execute goal fvarrui.maven:javapackager:0.8.6:package (default) on project phPatcher: Execution default of goal fvarrui.maven:javapackager:0.8.6:package failed. NullPointerException -> [Help 1]
It is strange because I went into the phPatcher app and verified that the /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar
exist.
My new plugin config is as follows:
<plugin>
<groupId>fvarrui.maven</groupId>
<artifactId>javapackager</artifactId>
<version>0.8.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<mainClass>com.marcoristuccia.phpatcher.phPatcher</mainClass>
<displayName>phPatcher</displayName>
<organizationName>Marco Ristuccia</organizationName>
<organizationUrl>http://www.marcoristuccia.com/it</organizationUrl>
<bundleJre>true</bundleJre>
<forceJreOptimization>false</forceJreOptimization>
<administratorRequired>false</administratorRequired>
<generateInstaller>false</generateInstaller>
</configuration>
</execution>
</executions>
</plugin>
Hi again Fran,
sorry, I have no rights to reopen this issue. Hope that you see my comments here in any case and maybe reopen the issue.
In addition to the problem described in the above comment, I tried the 0.8.6. Point 3 seems to be fixed (I see the PATH inside the script), but the new-line encoding seems still wrong. I think you left only the \r and removed the \n. You should do the opposite...
Thanks again for your support.
What embarrasing! Sorry, I trusted Notepad++ in order to change Windows newline style to MacOS and it removed \n and left \r characters. I’ll fix it as soon as possible. And I think I know what *.jar
is.
Hi Marco, I've already replaced \r for \n characters.
The *.jar
problem is related to the next log line:
[info] Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar
because the plugin is trying to use the next line "Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar"
(returned by jdeps
) as a module for jlink
in order to generate a customized JRE. I patched it to ignore jdeps
lines which starts with the "Warning" string, but it isn't a good solution.
I need to find out why jdeps
is returning that line on MacOS.
Please, try again with v0.8.6 (you need to remove JavaPackager 0.8.6 from your local repo - .m2 folder, so new plugin version will be downloaded from remote repo again).
Thanks so much!
Hi Fran,
I think we are close to the solution. Point 1 is fixed, the script startup file is well formed and runs.
As far as point 2 and *.jar
, there is still a "Path does not exists" error.
The project builds successfully now, but it does not work. I suspect something of the packed JRE is missing due to that error.
Bundling JRE ... with /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
- Creating customized JRE ...
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jdeps -q --ignore-missing-deps --list-deps --multi-release 13 /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar
[info] Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar
[info] java.base
[info] java.desktop
[info] java.logging
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jlink --module-path /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/jmods --add-modules java.base,java.desktop,java.logging --output /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home --no-header-files --no-man-pages --strip-debug --compress=2
Writing the Info.plist file
Copying additional resources
[info] Copying file [/usr/local/bin/exiftool] to folder [/Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources]
[info] Copying folder [/usr/local/bin/lib] to folder [/Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources]
[info] Executing command: codesign --force --deep --sign - /Users/marco/Developer/phPatcher/target/app/phPatcher.app
[error] /Users/marco/Developer/phPatcher/target/app/phPatcher.app: bundle format unrecognized, invalid, or unsuitable
[error] In subcomponent: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home/legal/java.xml
App Bundle generation finished
--- maven-assembly-plugin:3.1.1:single (default) @ phPatcher ---
Reading assembly descriptor: src/main/assembly/zip.xml
Building zip: /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT.zip
--- maven-install-plugin:2.4:install (default-install) @ phPatcher ---
Installing /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT.jar to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT.jar
Installing /Users/marco/Developer/phPatcher/pom.xml to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT.pom
Installing /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT-runnable.jar
Installing /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT.zip to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT.zip
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 8.678 s
Finished at: 2020-01-08T16:22:08+01:00
Final Memory: 30M/128M
------------------------------------------------------------------------
If I run the command manually, after the build finished, I see a richer set of copied modules, and no "Path not found" error: 🤨
$ /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jdeps -q --ignore-missing-deps --list-deps --multi-release 13 /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar
java.base
java.desktop/sun.awt
java.desktop/sun.swing
java.logging
java.scripting
java.sql
java.xml
jdk8internals/sun.reflect
Does app execution from command line print anything on terminal? Maybe the problem is due to a missing module, related to this warning message:
[info] Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar
I'm preparing a MacOS virtual environment to be able to do tests.
While running the app I get at a certain point this exception:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: java/sql/Date
at org.apache.commons.beanutils.ConvertUtilsBean.registerOther(ConvertUtilsBean.java:730)
at org.apache.commons.beanutils.ConvertUtilsBean.deregister(ConvertUtilsBean.java:602)
at org.apache.commons.beanutils.ConvertUtilsBean.<init>(ConvertUtilsBean.java:161)
...
I've managed to reproduce the problem on MacOS, but I'm still trying to figure out where it is. It looks like /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs
folder doesn't exist when jdeps
is called:
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jdeps -q --ignore-missing-deps --list-deps --multi-release 13 /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar
[info] Warning: Path does not exist: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/*.jar
[info] java.base
[info] java.desktop
[info] java.logging
Class java.sql.Date
belongs to java.sql
module, which it isn't been included due to this problem.
Maybe we could bypass this problem forcing the inclusion of all modules with a plugin option, till we find the cause of the problem.
Yes, that seems the problem. But I too didn't figure out the reason why. It's odd. Will try to investigate more... In the meantime I will not embed the JRE inside the app.
Hi Marco,
I found another way to specify library JAR files to jdeps
for analyzing module dependencies. Instead of specify a wildcard (*), I'm manually looking for all JAR files in libs
folder. This solution is a bit dirty in log output, but it works on all platforms.
I also realized that jdeps
works different from one JDK version from another, so I've implemented a different behavior in each case.
I'd like to ask you something: why do you need export PATH...
line in startup.sh? why don't you use a full path to find the command?
And finally: please, could you try v0.8.7.
Thanks so much!
Hi Fran,
regarding the PATH, I'm using the ExifTool library, It seems a sort of wrapper for the executable, but the library instantiation method doesn't give the option to specify where the executable is. It searches it inside the folders specified in the PATH variable.
By the way I think that for the PATH it would be great (in a future version) having a settable parameter in the plugin's config section, so that it can be customisable.
I just tried the 0.8.7, but it seems that there is still a little problem, it doesn't find the module "java.sql".
- Creating customized JRE ...
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jdeps -q --ignore-missing-deps --print-module-deps --multi-release 13 /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/annotations-16.0.1.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-logging-1.2.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-lang3-3.9.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/opencsv-5.0.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/exiftool-lib-2.5.0.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-collections4-4.4.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-io-2.6.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-collections-3.2.2.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/darcula-2018.2.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-beanutils-1.9.4.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-text-1.7.jar /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar
[info] java.base,java.desktop,java.scripting,java.sql
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jlink --module-path /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/jmods --add-modules java.base,java.desktop,java.scripting,java.sql
--output /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home --no-header-files --no-man-pages --strip-debug --compress=2
[info] Error: Module java.sql
[info] not found
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 3.826 s
Finished at: 2020-01-09T18:12:57+01:00
Final Memory: 26M/114M
------------------------------------------------------------------------
Failed to execute goal fvarrui.maven:javapackager:0.8.7:package (default) on project phPatcher: Execution default of goal fvarrui.maven:javapackager:0.8.7:package failed. NullPointerException -> [Help 1]
But oddly If I manually run the command:
/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jlink --module-path /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/jmods --add-modules java.base,java.desktop,java.scripting,java.sql --output /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home --no-header-files --no-man-pages --strip-debug --compress=2
it runs without errors.
I'm going crazy with this oddly behaviour. That module has to be there. You can check it running next command:
java --list-modules
I think it's including \n
at the end of the parameter, so next log message:
[info] Error: Module java.sql
[info] not found
must be
[info] Error: Module java.sql not found
But it maybe show this way because there's a new line at the end of the last module name.
I'll try to trim all params before invoke commands like jdeps
and jlink
.
Hi Marco, I've fixed and tried JavaPackager v0.8.7 on MacOS 10.12 + JDK 13 and JDK 10 and it worked fine. Could you confirm me, please?
Hi Fran,
tried again by cleaning the maven cache and then building again with 0.8.7. The build ends without errors, with the exception of the code signing, which always has problems with the JRE.
Bundling JRE ... with /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
- Creating customized JRE ...
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jdeps -q --ignore-missing-deps --print-module-deps --multi-release 13 /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/annotations-16.0.1.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-logging-1.2.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-lang3-3.9.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/opencsv-5.0.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/exiftool-lib-2.5.0.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-collections4-4.4.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-io-2.6.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-collections-3.2.2.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/darcula-2018.2.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-beanutils-1.9.4.jar /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources/Java/libs/commons-text-1.7.jar /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar
[info] java.base,java.desktop,java.scripting,java.sql
[info] Executing command: /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/bin/jlink --module-path /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/jmods --add-modules java.base,java.desktop,java.scripting,java.sql --output /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home --no-header-files --no-man-pages --strip-debug --compress=2
Writing the Info.plist file
Copying additional resources
[info] Copying file [/usr/local/bin/exiftool] to folder [/Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources]
[info] Copying folder [/usr/local/bin/lib] to folder [/Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/Resources]
[info] Executing command: codesign --force --deep --sign - /Users/marco/Developer/phPatcher/target/app/phPatcher.app
[error] /Users/marco/Developer/phPatcher/target/app/phPatcher.app: bundle format unrecognized, invalid, or unsuitable
[error] In subcomponent: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home/legal/java.xml
App Bundle generation finished
Generating DMG disk image file
[info] Creating symbolic link [/Users/marco/Developer/phPatcher/target/app/Applications] to [/Applications]
Generating the Disk Image file
[info] Executing command: hdiutil create -srcfolder /Users/marco/Developer/phPatcher/target/app -volname phPatcher /Users/marco/Developer/phPatcher/target/phPatcher_1.0-SNAPSHOT.dmg
[info] created: /Users/marco/Developer/phPatcher/target/phPatcher_1.0-SNAPSHOT.dmg
--- maven-assembly-plugin:3.1.1:single (default) @ phPatcher ---
Reading assembly descriptor: src/main/assembly/zip.xml
Building zip: /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT.zip
--- maven-install-plugin:2.4:install (default-install) @ phPatcher ---
Installing /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT.jar to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT.jar
Installing /Users/marco/Developer/phPatcher/pom.xml to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT.pom
Installing /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT-runnable.jar to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT-runnable.jar
Installing /Users/marco/Developer/phPatcher/target/phPatcher-1.0-SNAPSHOT.zip to /Users/marco/.m2/repository/com/marcoristuccia/phPatcher/1.0-SNAPSHOT/phPatcher-1.0-SNAPSHOT.zip
--- exec-maven-plugin:1.6.0:exec (default) @ phPatcher ---
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 15.040 s
Finished at: 2020-01-10T21:59:39+01:00
Final Memory: 30M/120M
------------------------------------------------------------------------
Running the app I still have a problem, I get this exception:
Exception in thread "AWT-EventQueue-0" java.nio.file.ProviderNotFoundException: Provider "jar" not found
at java.base/java.nio.file.FileSystems.newFileSystem(Unknown Source)
at java.base/java.nio.file.FileSystems.newFileSystem(Unknown Source)
at com.marcoristuccia.phpatcher.ImageTagger.tagP1EipFile(ImageTagger.java:324)
at com.marcoristuccia.phpatcher.ImageTagger.doTag(ImageTagger.java:270)
It seems that something in the java.nio.* has not been copied in. Not sure whether this is a problem of your plugin ore something else. It could be a problem with the JDK 13.
I'm not sure where the problem is. It seems that a module is missing because jdeps
isn't detecting it. I've been reading some articles about java.nio.file.ProviderNotFoundException: Provider "jar" not found
and it seems to be caused due to jdk.zipfs
module is missing.
In the meantime, there are some alternatives:
1) Manually add jdk.zipfs
module with the next piece of config:
<additionalModules>
<param>jdk.zipfs</param>
</additionalModules>
forcing jlink
to include this module in the generated JRE.
2) Embed a non-optimized full JRE using next option:
<customizedJre>false</customizedJre>
This one makes that your app take too much disk space.
3) Copy JRE included in JDK with this option:
<jrePath>path/to/jre</jrePath>
This one makes that your project depends on an specific development environment configuration.
4) Not embed JRE into the app:
<bundleJre>false</bundleJre>
This one makes that your app depends on the availability of a JRE in final user host.
Maybe the substance of the matter is that we are mixing modular and non-modular jars.
Thanks for your time!
Hi Fran,
by adding the jdk.zipfs as "additionalModule" everything works great. Thank you for your pristine and quick support!
I'll close the issue.
Hi Marco,
I only want to inform you that codesign
error has been solved removing legal
folder from generated JRE on MacOS.
One less thing!
Hi Fran, it works like a charm! :) Thank you again!
Hi Fran,
thank you for this plugin. I started experimenting with it with MacOS Mojave 10.14.6 under Netbeans 11.2 and JDK 13.0.1 and JDK 1.8.0_77 and have some problems:
The first one is that I cannot start the app because the script/Contents/MacOS/startup contains DOS/Windows newlines (with (hidden) ^M). After opening the script in vi and issuing the command ":set fileformat=unix" and resaving it the application starts.
When I embed a JDK the code signing doesn't work, it gives an error:
[info] Executing command: codesign --force --deep --sign - /Users/marco/Developer/phPatcher/target/app/phPatcher.app
[error] /Users/marco/Developer/phPatcher/target/app/phPatcher.app: bundle format unrecognized, invalid, or unsuitable
[error] In subcomponent: /Users/marco/Developer/phPatcher/target/app/phPatcher.app/Contents/PlugIns/jre/Contents/Home/legal/java.management.rmi
By correcting the script as described on point 1 and by not embedding the JDK I can run the app by executing the script on CLI, but if I double click the App on the GUI it opens for a second and then it closes again. Still figuring out what the problem can be. I'll let you know.