Open DatL4g opened 4 years ago
I think there is some confusion going on here :) You can't execute a jar-file, you can run it with the java-command. However, some linux distros will employ a mechanism that makes it looks like you execute the jar file, but under the hood it's calling java -jar yourjarfile.jar
.
To generate the native installers you must have javapackager
installed, as the error message hints to. Java Packager is available with the JDK8 distribution from Oracle, probably not with OpenJDK.
Yeah I allready tried this but got an error:
MainClass fxlauncher.Launcher not found
java.lang.NoClassDefFoundError: javafx/application/Application
I'm not sure if this depends on my Application class, located in src/main/kotlin tried MainApplication and kotlin.MainApplication as applicationMainClass same result for both
Yeah I allready tried this but got an error: MainClass fxlauncher.Launcher not found
java.lang.NoClassDefFoundError: javafx/application/Application
I'm not sure if this depends on my Application class, located in src/main/kotlin tried MainApplication and kotlin.MainApplication as applicationMainClass same result for both
@edvin @DATL4G was this resolved I am running into this too.
I have setup maven pipeline and installed all required tools. Mvn clean package runs successfully. But when trying to execute the fxlaunch.jar via Java command I get the same error. How can I resolve this? Setup: Java Env:
❯ java -version
openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment Corretto-15.0.2.7.1 (build 15.0.2+7)
OpenJDK 64-Bit Server VM Corretto-15.0.2.7.1 (build 15.0.2+7, mixed mode, sharing)
openjfx: javafx-sdk-16
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>
<artifactId>mainModule</artifactId>
<groupId>me.mathi</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mainModule</name>
<properties>
<kotlin.version>1.5.0-RC</kotlin.version>
<javafx.version>15</javafx.version>
<tornadofx.version>2.0.0-SNAPSHOT</tornadofx.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.code.style>official</kotlin.code.style>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
<!-- Installer Filename without suffix -->
<app.filename>MyAppTest</app.filename>
<!-- The JavaFX Application class name -->
<app.mainClass>com.example.demo.app.MyApp</app.mainClass>
<!-- Optional override to specify where the cached files are stored. Default is current working directory -->
<app.cacheDir>USERLIB/MyAppTest</app.cacheDir>
<!-- Optional parameters to the application, will be embedded in the launcher and can be overriden on the command line -->
<app.parameters>--myOption=myValue --myOtherOption=myOtherValue</app.parameters>
<!-- The Application vendor used by javapackager -->
<app.vendor>Mathis Michel</app.vendor>
<!-- The Application version used by javapackager -->
<app.version>1.0</app.version>
<!-- Base URL where you will host the application artifacts -->
<app.url>http://localhost:8080</app.url>
<!-- Optional scp target for application artifacts hosted at the above url -->
<!-- <app.deploy.target>w48839@fxldemo.tornado.no:fxldemo</app.deploy.target>-->
<!-- The app and launcher will be assembled in this folder -->
<app.dir>${project.build.directory}/app</app.dir>
<!-- Native installers will be built in this folder -->
<app.installerdir>${project.build.directory}/installer</app.installerdir>
<!-- Should the client downgrade if the server version is older than the local version? -->
<app.acceptDowngrade>false</app.acceptDowngrade>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<!-- Compile project jar to appdir -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>${app.dir}</outputDirectory>
</configuration>
</plugin>
<!-- Copy dependencies to appdir -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<excludeScope>provided</excludeScope>
<outputDirectory>${app.dir}</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<!-- Generate app.xml manifest -->
<executions>
<execution>
<id>create-manifest</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>fxlauncher.CreateManifest</mainClass>
<arguments>
<argument>${app.url}</argument>
<argument>${app.mainClass}</argument>
<argument>${app.dir}</argument>
<argument>--cache-dir=${app.cacheDir}</argument>
<argument>--accept-downgrade=${app.acceptDowngrade}</argument>
<argument>--include-extensions=jpg</argument>
<argument>${app.parameters}</argument>
</arguments>
</configuration>
</execution>
<!-- Embed app.xml inside fxlauncher.xml so we don't need to reference app.xml to start the app -->
<execution>
<id>embed-manifest-in-launcher</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>jar</executable>
<workingDirectory>${app.dir}</workingDirectory>
<arguments>
<argument>uf</argument>
<argument>fxlauncher.jar</argument>
<argument>app.xml</argument>
</arguments>
</configuration>
</execution>
<!-- Use jpackage to make installer -->
<execution>
<id>installer</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>jpackage</executable>
<arguments>
<argument>--name</argument>
<argument>${app.filename}</argument>
<argument>--input</argument>
<argument>${app.dir}</argument>
<argument>--main-jar</argument>
<argument>fxlauncher.jar</argument>
<argument>--main-class</argument>
<argument>fxlauncher.Launcher</argument>
<argument>--dest</argument>
<argument>${app.installerdir}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>no.tornado</groupId>
<artifactId>tornadofx</artifactId>
<version>${tornadofx.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>no.tornado</groupId>
<artifactId>fxlauncher</artifactId>
<version>1.0.21</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>${javafx.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
@edvin , @DATL4G, @mathis-m got the same error -> "Class fxlauncher/Launcher not found."
This happens when you startup the application after installation.
If I run the fxlauncher.jar via the terminal with the command below, everything runs successfully.
Looks like its some issue with how the generated exe looks for the fxlauncher.jar?
java -jar fxlauncher.jar
I run deployApp and I get a app.xml, fxlaucher.jar and App-1.0.jar When I try to run the fxlauncher.jar the console output is:
cannot execute binary file: format error
I definitely made the file executable
And when I try to run generateNativeInstaller, there is a error while executing task:
java.io.IOException: Cannot run program "javapackager": error=2, File not found
But I have openjfx installedMy gradle looks like: