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.05k stars 132 forks source link

problem #20

Closed mhxw closed 4 years ago

mhxw commented 4 years ago

Hi Fran, I have problem with the new 0.9.1 version. Can openjfx13 be used?

fvarrui commented 4 years ago

Hi @holechain , I think so, but tell me what your problem is, please. Could you share your Maven logs? From which platform are you using JavaPackager? By the way, I've just published v0.9.3 in order to solve issue #19 ... maybe this is your problem.

mhxw commented 4 years ago

thanks,my problem is that the packaged program of jdk13 cannot run.

mhxw commented 4 years ago

Error: JavaFX runtime components are missing, and are required to run this application

fvarrui commented 4 years ago

Sorry, I need more info. Could you share you POM and Maven output, please?

fvarrui commented 4 years ago

I don’t see JavaPackager plugin in your POM

mhxw commented 4 years ago

My project is developed by openjfx13. I use this :https://github.com/javafx-maven-plugin/javafx-maven-plugin to package and run the program. The program cannot be run after using this https://github.com/fvarrui/JavaPackager/tree/v0.9.3 package.

fvarrui commented 4 years ago

I also used javafx-maven-plugin until it was no longer maintained, so I decided to develop my own plugin.

I think the problem was <vmArgs>--module-path="storage\libs"</vmArgs>; it's not necessary. Further, many of the functions performed by the plugins you are using in your POM are already performed by JavaPackager.

I tried to reduce your POM and I hope I haven't removed important parts. Take a look:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>yunchucun-C-PC-java</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>storage</name>

    <properties>
        <client.version>1.0.0</client.version>
        <exec.maven.plugin.version>1.6.0</exec.maven.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>com.mandela.Main</mainClass>
        <javafx.version>13.0.1</javafx.version>
        <maven.compiler.source>13</maven.compiler.source>
        <maven.compiler.target>13</maven.compiler.target>
        <maven.compiler.release>13</maven.compiler.release>
    </properties>

    <repositories>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
    </repositories>

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.fxml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>io.github.fvarrui</groupId>
                <artifactId>javapackager</artifactId>
                <version>0.9.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <mainClass>${mainClass}</mainClass>
                            <bundleJre>true</bundleJre>
                            <generateInstaller>true</generateInstaller>
                            <iconFile>show/image/icon/icon.ico</iconFile>
                            <additionalResources>
                                <param>show</param>
                                <param>D:\test\peer_root\peer.dll</param>
                                <param>D:\test\peer_super\conf</param>
                            </additionalResources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-web</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-swing</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.8</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.9.2</version>
        </dependency>
        <dependency>
            <groupId>com.onlyxiahui</groupId>
            <artifactId>only-app-fx</artifactId>
            <version>0.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.codefx.libfx</groupId>
            <artifactId>LibFX</artifactId>
            <version>0.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.1.5.RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.8</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.8</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.3</version>
        </dependency>
    </dependencies>

</project>
mhxw commented 4 years ago

Ok,I try it out,thank you

fvarrui commented 4 years ago

Ok. Please, can you send mvn package output? I would like to know If JavaFX runtime libraries are being copied to libs.

mhxw commented 4 years ago

Take the liberty to ask, if you have time, you can use teamviewer to connect to my computer to operate.

fvarrui commented 4 years ago

Shall we meet at https://meet.jit.si/JavaPackager?

fvarrui commented 4 years ago

I'm waiting ... are you ready?

fvarrui commented 4 years ago

How to solve "Error: JavaFX runtime components are missing, and are required to run this application":

  1. Create a new class (e.g. Main) which not extends Application with a main method.
  2. Call App.main (App extends Application) method from Main.main.
  3. Now run the app calling Main.main.
  4. That's all!
public class App extends Application {
    [...]
    public static void main(String [] args) {
        launch(args);
    }
    [...]
}
public class Main {
    public static void main(String [] args) {
        App.main(args);
    }
}

This solves the problem.

mhxw commented 4 years ago

OK,thanks

------------------ 原始邮件 ------------------ 发件人: "fvarrui"<notifications@github.com>; 发送时间: 2020年3月14日(星期六) 晚上8:52 收件人: "fvarrui/JavaPackager"<JavaPackager@noreply.github.com>; 抄送: "793630556"<nrgh@foxmail.com>; "Mention"<mention@noreply.github.com>; 主题: Re: [fvarrui/JavaPackager] problem (#20)

How to solve "Error: JavaFX runtime components are missing, and are required to run this application":

Create a new class (e.g. Main) which not extends Application with a main method.

Call App.main (App extends Application) method from Main.main.

Now run the app calling Main.main.

That's all! public class App extends Application { [...] public static void main(String [] args) { launch(args); } [...] } public class Main { public static void main(String [] args) { App.main(args); } }

This solves the problem.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

NewStorm-0 commented 8 months ago

How to solve "Error: JavaFX runtime components are missing, and are required to run this application":

  1. Create a new class (e.g. Main) which not extends Application with a main method.
  2. Call App.main (App extends Application) method from Main.main.
  3. Now run the app calling Main.main.
  4. That's all!
public class App extends Application {
    [...]
    public static void main(String [] args) {
        launch(args);
    }
    [...]
}
public class Main {
    public static void main(String [] args) {
        App.main(args);
    }
}

This solves the problem.

Hello, do you have any plans to fix it in the new version? I'm still experiencing the problem while using the version 1.7.5