Detecting the closest color to each pixel of a pre-pixelized image
Juste grab the latest jar artifact in the release tab, and launch it with java. No fuss.
Check these steps to configure the project correctly.
It's also serves as a reminder, for my lazy brain.
Open-jdk is accessible on the official website.
JavaFX is hosted on Gluon.
To compile the project with IntelliJ :
- Check out the project from github
- Configure the source folder in the Content Root
- Build (choose one)
- Maven : Create a Maven configuration with
javafx:run
(andBuild
before launch) - Application with VM options :
-p </path/jafx-sdk>/lib --add-modules javafx.controls,javafx.fxml,javafx.swing
- Maven : Create a Maven configuration with
- Run the configuration
Make sure you have the JDK referenced in the project settings.
This project is configured with JavaFX as a Maven dependency.
The actual JavaFX situation with Maven is, either :
- Use the com.zenjava maven plugin with Java 8 or 9
- Use Java 8 or 9 and don't specify maven dependecy for JavaFX
- Use the org.openjfx with Java 11+
Source on stackoverflow
Reminder
As of OpenJDK-8/JDK-11, JavaFX is no longer included in the base JDK.
You will need to install the openjfx package.
Or make sure that your JDK contains this file :<Java SDK root>/jre/lib/ext/jfxrt.jar
.
With Java 8 or 9, package the application in a simple jar artifact to access it outside of the IDE.
Extra step for Java 11+ :
You will need the JavaFX SDK libraries, corresponding to your platform.
Then, you will be able to launch the app with this command :
java -p javafx-sdk-11.0.2/lib \
--add-modules javafx.controls,javafx.fxml,javafx.swing \
-jar pixel_comparator.jar
You might encounter one of this errors with the IntelliJ IDE.
Error:java: error: release version 5 not supported
Force target Maven version to the JDK version (default is 1.5, which might not be appropriate for your JDK).
Change the source/target configuration in the POM.
https://stackoverflow.com/a/12900859
IllegalAccessError with FXMLLoaderHelper
IntelliJ doesn't load all JavaFX module by default.
Add VM options : https://stackoverflow.com/a/54292408
Or run Maven goal javafx:run
Complete answer : https://stackoverflow.com/a/52470141