1

I'm using Netbeans 11 and I've created a barebone test Maven Java 13 project that I cannot build/run.

I haven't used Maven before.

After fiddling around some basic dependencies, I ended up with an error indicating that the javafxpackager command could not be found when trying to build it.

There is no such command anywhere on my system.

After some searching, it seems that the binary in question was once part of the openjfx package (package is installed, version 11 I believe) but since then it was both renamed to javapackager and also removed from said package.

No "javapackager" seems to be available in the default Ubuntu packages.

I have the openjdk package installed, version 13. I have also downloaded the Oracle JDK, but there is no such binary inside.

Netbeans downloaded the needed javafx dependencies, so I assume they are compatible with the installed JDK.

  1. How do I install this? Where do I get it from?
  2. Considering that Netbeans still uses the archaic name "javafxpackager" (meaning that the project template is extremely old and out of date), is there something I can do to get around this? An alternative packager? And how do I integrate it with my Maven project?

Edit:

The pom.xml file can be viewed here. It is the default file created by Netbeans, with the only addition being the javafx-fxml dependency (which strangely was also not included by default in the pom.xml template, although the code required it):

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-fxml</artifactId>
    <version>13</version>
</dependency>
Boris
  • 22,667
  • 16
  • 50
  • 71
Silviu G
  • 1,241
  • 10
  • 31
  • 2
    It was removed, but [eventually it will be brought back](https://openjdk.java.net/jeps/343) as a general Java tool which is not specific to JavaFX, though it will of course work with JavaFX applications. For now, one alternative is to [jlink the application](https://stackoverflow.com/questions/53453212/how-to-deploy-a-javafx-11-desktop-application-with-a-jre). – VGR Oct 10 '19 at 16:32
  • Please add the POM file to the question. – Boris Oct 10 '19 at 16:33

1 Answers1

0

Below is a full working example using JavaFX 13 with Maven:

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.openjfx</groupId>
  <artifactId>HelloFX</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <java.version>13</java.version>
    <javafx-controls.version>13</javafx-controls.version>
    <javafx-fxml.version>13</javafx-fxml.version>
    <javafx-maven-plugin.version>0.0.3</javafx-maven-plugin.version>
    <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>${javafx-controls.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>${javafx-fxml.version}</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <release>${java.version}</release>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>${javafx-maven-plugin.version}</version>
        <configuration>
          <mainClass>org.openjfx.hellofx.App</mainClass>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Run the project:

$ mvn clean javafx:run
Boris
  • 22,667
  • 16
  • 50
  • 71