fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 134 forks source link

Plugin searches for some library `tool.jar` on Mac under hard coded, non-existing path and fails right away #417

Closed pfeiferd closed 5 months ago

pfeiferd commented 5 months ago

I'm submitting a…

Short description of the issue/suggestion: I got a Maven error right away on IOS:

...
[ERROR] Failed to execute goal io.github.fvarrui:javapackager:1.7.5:package (default) on project genestrip: Execution default of goal io.github.fvarrui:javapackager:1.7.5:package failed: Plugin io.github.fvarrui:javapackager:1.7.5 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.8.0 at specified path /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/../lib/tools.jar -> [Help 1]
...

Steps to reproduce the issue/enhancement:

I used the following Plugin config (with some variations) but always got the error from above:

...
            <plugin>
                <groupId>io.github.fvarrui</groupId>
                <artifactId>javapackager</artifactId>
                <version>1.7.5</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <mainClass>${main.class}</mainClass>
                            <bundleJre>true</bundleJre>
                            <jrePath>/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk</jrePath>
                            <platform>mac</platform>
                            <modules>java.base</modules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
...

What is the expected behavior?

Some kind of successful packaging

What is the current behavior?

Plugin does not even start to package...

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

Please tell us about your environment:

Other information (e.g. related issues, suggestions how to fix, links for us to have context) I can see that the following (slightly different) path exists on my Mac:

 /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/

so without .. and also tool.jaris not included on the above folder.

Thanks in advance. It is meant to become an excutable for this project

pfeiferd commented 5 months ago

Not even a comment on this from the developers? So discouraging :(

fvarrui commented 5 months ago

Hi @pfeiferd!

Please, don't feel this way, I try to answer ASAP on my free time. There are no developers, just me. Sorry!

Try to not bundle a JDK with your app and let JP to generate a custom Java runtime.

fvarrui commented 5 months ago

Please, could you share mvn -v output?

fvarrui commented 5 months ago

I've just build your app on Windows without problems. Could you share the full build output, please? I think your issue is with your environment (JDK)

pfeiferd commented 5 months ago

Not even a comment on this from the developers? So discouraging :(

Sorry - I did not know...

pfeiferd commented 5 months ago

I've just build your app on Windows without problems. Could you share the full build output, please? I think your issue is with your environment (JDK)

Hi, my apologies for putting on pressure. I will try my luck with jpackage - not knowing yet what pains it will bring. There is a maven plugin that basically calls the command and passes on the parameter: https://akman.github.io/jpackage-maven-plugin/ I think you need the JDK 14 for this stoff though - and potentially modules...

pfeiferd commented 5 months ago

Hi again, I got it running in windows - totally pain-free. THAANKS!

            <plugin>
                <groupId>io.github.fvarrui</groupId>
                <artifactId>javapackager</artifactId>
                <version>1.7.5</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <mainClass>${main.class}</mainClass>
                            <bundleJre>true</bundleJre>
                            <jrePath>C:/java/jdk-17.0.2</jrePath>
                            <platform>windows</platform>
                            <copyDependencies>true</copyDependencies>
                            <winConfig>
                                <generateSetup>false</generateSetup>
                                <generateMsi>false</generateMsi>
                                <generateMsm>false</generateMsm>

                                <!-- exe creation properties -->
                                <headerType>console</headerType>
                                <wrapJar>true</wrapJar>
                                <exeCreationTool>launch4j</exeCreationTool>
                            </winConfig>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

jpackage involves modules and config pain (as I learned this morning) - and creates anoying installers. Your tool is very helpful indeed!

fvarrui commented 5 months ago

Hi again, I got it running in windows - totally pain-free. THAANKS!

          <plugin>
              <groupId>io.github.fvarrui</groupId>
              <artifactId>javapackager</artifactId>
              <version>1.7.5</version>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals>
                          <goal>package</goal>
                      </goals>
                      <configuration>
                          <mainClass>${main.class}</mainClass>
                          <bundleJre>true</bundleJre>
                          <jrePath>C:/java/jdk-17.0.2</jrePath>
                          <platform>windows</platform>
                          <copyDependencies>true</copyDependencies>
                          <winConfig>
                              <generateSetup>false</generateSetup>
                              <generateMsi>false</generateMsi>
                              <generateMsm>false</generateMsm>

                              <!-- exe creation properties -->
                              <headerType>console</headerType>
                              <wrapJar>true</wrapJar>
                              <exeCreationTool>launch4j</exeCreationTool>
                          </winConfig>
                      </configuration>
                  </execution>
              </executions>
          </plugin>

jpackage involves modules and config pain (as I learned this morning) - and creates anoying installers. Your tool is very helpful indeed!

Happy to hear that! One thing: Don't bundle a JDK with your app (it's too heavy) and let JavaPackager to generate a reduced Java runtime for you (it uses jdeps and jlink to achieve this task, including only those modules needed for your app). Just omit jrePath. If the generated JRE doesn't include all your needed modules (any module is missing, problem fixed in 1.7.6-SNAPSHOT), you can set customizedJre=false and it will generate a full JRE (always lighter than a full JDK).

pfeiferd commented 5 months ago

I got it running for Windows: Total size (exe + jar + jre) = 50 MB! Here is my new project by the way: https://github.com/pfeiferd/genestrip-db

If you ever get Lyme disease - let me know: I know all the pain from this disease... That’s why I built this new type of software - it supports detection of infectious disease via DNA analysis.

Thanks again, Daniel

Am 25.06.2024 um 17:37 schrieb Francisco Vargas Ruiz @.***>:

Hi again, I got it running in windows - totally pain-free. THAANKS!

io.github.fvarrui javapackager 1.7.5 package package ${main.class} true C:/java/jdk-17.0.2 windows true false false false console true launch4j

jpackage involves modules and config pain (as I learned this morning) - and creates anoying installers. Your tool is very helpful indeed! Happy to hear that! One thing: Don't bundle a JDK with your app (it's too heavy) and let JavaPackager to generate a custom Java runtime for you (it uses jdeps and jlink to achieve this task). Just omit jrePath. If the generated JRE doesn't include all your needed modules (problem fixed in 1.7.6-SNAPSHOT), you can set customizedJre=false. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>


Progotec GmbH StarPlan - das Stundenplansystem für Hochschulen und Universitäten Prof. Dr. Daniel Pfeifer Geschäftsführer Im Jockele 13 D-74080 Heilbronn Büro: +49(0)7131-1201317 Mobil: +49(0)157-74981330 Mail: @.*** Link: http://www.progotec.de

fvarrui commented 5 months ago

I got it running for Windows: Total size (exe + jar + jre) = 50 MB! Here is my new project by the way: https://github.com/pfeiferd/genestrip-db If you ever get Lyme disease - let me know: I know all the pain from this disease... That’s why I built this new type of software - it supports detection of infectious disease via DNA analysis. Thanks again, Daniel

Great! Thanks for let me know and for using JP. Don't hesitate on ask any question.

EasyG0ing1 commented 4 months ago

@pfeiferd

Not even a comment on this from the developers? So discouraging :(

Sorry - I did not know...

What I'm curious about, is how is it that anyone could assume entitlement to support on open source software? Projects on GitHub are almost always open source, which means there are no paid developers and no kind of financial support happening for the people who create the projects. This means that receiving any support at all is an absolute gift and making comments such as you did only discourages people from participating. You should be grateful that you get any support at all, and you are NEVER entitled to it. If you want guaranteed support, then you should be paying for commercial software where guaranteed support becomes a factor of how much money you pay into the project.

fvarrui commented 4 months ago

Hi Mike! Thank you for your words of support, I think it was simply a misunderstanding. I must say that I really enjoy maintaining this project and helping as much as possible, since thanks to the community this project has been able to grow over time. It's a shame that I don't have more time to make it grow even more. And don't forget that any of you can buy me a coffee 😅

20231222_134308