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 133 forks source link

Failed to execute goal io.github.fvarrui:javapackage #353

Closed JasonCao1024 closed 1 year ago

JasonCao1024 commented 1 year ago

This is error message: [ERROR] Failed to execute goal io.github.fvarrui:javapackager:1.6.7:package (default) on project javafx: org.apache.maven.plugin.MojoExecutionException: Failed to build the executable; please verify your configuration.: net.sf.launch4j.ExecException: Exec failed (1): D:\1、java\mvn\net\sf\launch4j\launch4j\3.14\launch4j-3.14-workdir-win32\bin\windres.exe --preprocessor=type -J rc -O coff -F pe-i386 C:\Users\ALEXAN~1\AppData\Local\Temp\launch4j8568450954283583138rc C:\Users\ALEXAN~1\AppData\Local\Temp\launch4j660789751684011149o -> [Help 1

This is my pom.xml:

<plugins>
        <plugin>
            <groupId>io.github.fvarrui</groupId>
            <artifactId>javapackager</artifactId>
            <version>1.6.7</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>package</goal>
                    </goals>
                    <configuration>
                        <mainClass>alex.learn.MainApp</mainClass>
                        <bundleJre>false</bundleJre>
                        <generateInstaller>false</generateInstaller>
                        <administratorRequired>false</administratorRequired>
                        <platform>windows</platform>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

My current java version is 1.8, and the above error occurred when executing the package

fvarrui commented 1 year ago

Hi @AlexanderCaoyu! Please, try the latest JP version: 1.7.3

JasonCao1024 commented 1 year ago

Hi@AlexanderCaoyu!Please, try the latest JP version: 1.7.3 Thank you! But I tried to switch to version 1.7.3, the error message still appears

[ERROR] Failed to execute goal io.github.fvarrui:javapackager:1.7.3:package (default) on project javafx: org.apache.maven.plugin.MojoExecutionException: Failed to build the executable; please verify your configuration.: net.sf.launch4j.ExecException: Exec failed (1): D:\1、java\mvn\net\sf\launch4j\launch4j\3.50\launch4j-3.50-workdir-win32\bin\windres.exe --preprocessor=type -J rc -O coff -F pe-i386 C:\Users\ALEXAN~1\AppData\Local\Temp\launch4j6720689567674490477rc C:\Users\ALEXAN~1\AppData\Local\Temp\launch4j5459996924865524997o -> [Help 1][ERROR] Failed to execute goal io.github.fvarrui:javapackager:1.7.3:package (default) on project javafx: org.apache.maven.plugin.MojoExecutionException: Failed to build the executable; please verify your configuration.: net.sf.launch4j.ExecException: Exec failed (1): D:\1、java\mvn\net\sf\launch4j\launch4j\3.50\launch4j-3.50-workdir-win32\bin\windres.exe --preprocessor=type -J rc -O coff -F pe-i386 C:\Users\ALEXAN~1\AppData\Local\Temp\launch4j6720689567674490477rc C:\Users\ALEXAN~1\AppData\Local\Temp\launch4j5459996924865524997o -> [Help 1]

fvarrui commented 1 year ago

Are you setting any ICO file by storing it in assets dir?

fvarrui commented 1 year ago

Did you manage to fix it? 😮

JasonCao1024 commented 1 year ago

Are you setting any ICO file by storing it in assets dir?

No, I didn't set up any ICO files.

JasonCao1024 commented 1 year ago

Did you manage to fix it? 😮

Sorry, I just clicked the wrong one.😂

JasonCao1024 commented 1 year ago

May I ask whether this is related to the operating system, my own operating system is Win11. But it can executed normally on another computer with Win10 operating system.😢

fvarrui commented 1 year ago

Maybe it could be related to different Java development environments. Please, could you share mvn -v output on both systems?

JasonCao1024 commented 1 year ago

Maybe it could be related to different Java development environments. Please, could you share mvn -v output on both systems?

OK,. This is output with Win10 OS image

And this is Win11 OS,Which was upgraded last year image

fvarrui commented 1 year ago

How can you build your app with Maven on Windows 10 if JAVA_HOME env variable is not defined?

fvarrui commented 1 year ago

Please, can you manually run this command just after a failed build?

D:\1、java\mvn\net\sf\launch4j\launch4j\3.50\launch4j-3.50-workdir-win32\bin\windres.exe --preprocessor=type -J rc -O coff -F pe-i386 C:\Users\ALEXAN1\AppData\Local\Temp\launch4j6720689567674490477rc C:\Users\ALEXAN1\AppData\Local\Temp\launch4j5459996924865524997o

Extracted from your output as an example ... not sure if you censored or changed it before publish it

JasonCao1024 commented 1 year ago

How can you build your app with Maven on Windows 10 if JAVA_HOME env variable is not defined?

I don't know, but I've been building projects on IDEA

JasonCao1024 commented 1 year ago
D:\1、java\mvn\net\sf\launch4j\launch4j\3.50\launch4j-3.50-workdir-win32\bin\windres.exe --preprocessor=type -J rc -O coff -F pe-i386 C:\Users\ALEXAN1\AppData\Local\Temp\launch4j6720689567674490477rc C:\Users\ALEXAN1\AppData\Local\Temp\launch4j5459996924865524997o

Ok, but it tells me that the system cannot find the file specified image

fvarrui commented 1 year ago

Is this path right D:\1、java\mvn\net\sf\launch4j\launch4j\3.50\launch4j-3.50-workdir-win32\bin\windres.exe?

fvarrui commented 1 year ago

Maybe a weird character in any path on your environment settings? ... I seem to remember that launch4j doesn't support CJK characters in paths

JasonCao1024 commented 1 year ago

Is this path right D:\1、java\mvn\net\sf\launch4j\launch4j\3.50\launch4j-3.50-workdir-win32\bin\windres.exe?

Yes,It's right

JasonCao1024 commented 1 year ago

Maybe a weird character in any path on your environment settings? ... I seem to remember that launch4j doesn't support CJK characters in paths

Thrank you , you are right. After I changed the path 'D:\1、java' to 'D:\java', it succeeded😊

fvarrui commented 1 year ago

Great!!! 😃