si avevo visto quel link.
quello che non riesco a capire è come usare JavaFX con JDK 11.
l'ho installato sul mio pc, e messo come versione di default:
codice:
$ java --version
java 11 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
poi ho provato a vedere qui: https://openjfx.io/openjfx-docs/#maven
questo è il mio pom.xml:
codice:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mp.jnotes</groupId>
<artifactId>JNotes</artifactId>
<version>1.5</version>
<name>JNotes</name>
<dependencies>
<dependency>
<groupId>de.huxhorn.lilith</groupId>
<artifactId>de.huxhorn.lilith.3rdparty.junique</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.21.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.1.1</version>
</dependency>
</dependencies>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.mp.jnotes.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>com.mp.jnotes.Main</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
e questo è il risultato:
codice:
$ mvn compile exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.mp.jnotes:JNotes >------------------------
[INFO] Building JNotes 1.5
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ JNotes ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ JNotes ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to /run/media/matte/PUFFA/Project/JAVA/JNotes/target/classes
[INFO] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/ControllerMain.java: Some input files use unchecked or unsafe operations.
[INFO] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/ControllerMain.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/ControllerMain.java:[7,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/ControllerMain.java:[8,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/FXMLUtils.java:[3,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/FXMLUtils.java:[25,19] cannot find symbol
symbol: class FXMLLoader
location: class com.mp.jnotes.FXMLUtils
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/ControllerNota.java:[4,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/AboutController.java:[4,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/AboutController.java:[7,24] package javafx.scene.web does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/AboutController.java:[15,13] cannot find symbol
symbol: class HTMLEditor
location: class com.mp.jnotes.AboutController
..........................................
[INFO] 41 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.050 s
[INFO] Finished at: 2018-10-01T11:19:36+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project JNotes: Compilation failure: Compilation failure:
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/ControllerMain.java:[7,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/ControllerMain.java:[8,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/FXMLUtils.java:[3,19] package javafx.fxml does not exist
[ERROR] /run/media/matte/PUFFA/Project/JAVA/JNotes/src/main/java/com/mp/jnotes/FXMLUtils.java:[25,19] cannot find symbol
[ERROR] symbol: class FXMLLoader
[ERROR] location: class com.mp.jnotes.FXMLUtils