openjfx / samples

JavaFX samples to run with different options and build tools
BSD 3-Clause "New" or "Revised" License
594 stars 1.52k forks source link

Eclipse with the library jars not working #77

Open goofyseeker311 opened 8 months ago

goofyseeker311 commented 8 months ago

Its very disheartening when you download the hellofx example app, extract it into a project directory, and load all the external jars as module path include in the IDE in an user library then Eclipse compiles and removes all the errors etc, but run button does not work.

Error: Could not find or load main class MyClass Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

edit: eclipse has a runtime setting of which modules on the module list to load, and its by default nothing, needs to be changed manually to MODULE-PATH.

edit: next error is hellofx.fxml loading error even if it has correct path. edit: solution: fx:controller= variable needs correct class name.

why Java application requires fxml to run?

making a runnable jar from eclipse with including library jars in package is not working also when running with oracle java-21 jvm in java-17 compatibility mode.

additionally the instructions for modular eclipse ide getting hellofx running or app image do not work, both not finding either hellofx module or the jmod required files.

error when running with java -jar myapplication.jar from command line on windows 11 (same code works from eclipse run button):


Feb 17, 2024 1:32:25 AM com.sun.javafx.application.PlatformImpl startup WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @971b07' Graphics Device initialization failed for : d3d, sw Error initializing QuantumRenderer: no suitable pipeline found java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283) at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253) at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:263) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162) at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95) at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125) ... 1 more Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:62) Caused by: java.lang.RuntimeException: No toolkit found at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:275) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162) at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196) at java.base/java.lang.Thread.run(Thread.java:1583)


goofyseeker311 commented 8 months ago

Not working even after by hand loading the binary dlls with System.load() from a temp directory.

edit: actually just copying all the javafx jars to the root of the app jar works, but not on linux, some gtk class def not found error. javafx.web library and dlls/so was removed to limit size.

edit: actually copying only the current platform jars and binaries to the root of the jar works for all platforms. multiplatform fat distribution .jar file by hand?

goofyseeker311 commented 8 months ago

why does JavaFX disable system clipboard for other Java Swing JFrame windows started from the JavaFX application thread? drag and drop works for the other Java Swing JFrame windows.

goofyseeker311 commented 8 months ago

Potential drop targets documentation is incorrect when using scene.addEventHandler(DragEvent.ANY, handler). specifically if you test for dragboard.hasImage, it will return false, even if the image shows link, copy, move when accepting without testing. unless image files are always moved as files.

yep the drop in images were files not images.

goofyseeker311 commented 8 months ago

shift-mwheel seems to lack ScrollEvent.getDeltaY() completely, its zero always. ctril, ctrl-alt, alt + mwheel always has a delta value. why is shift-mwheel considered horizontal scrolling by default.

goofyseeker311 commented 8 months ago

SwingFXUtils.toFXImage and inverse do not conserve alpha of BufferedImages, or clipboard putImage operation ignores alpha, puts black background even if alpha was desired to be copied. when copying back from clipboard, the image seems to be empty, like alpha 0.0 on all pixels, and causes a neat effect when painted over with transparent colors, when converted to BufferedImage, all assumed to have fully functioning alpha channels and color blending.

goofyseeker311 commented 8 months ago

Transparent materials is not working out of the box (triangle pre-sort optically thin two-sided alpha color on materials). transparency alpha color is not turned on even if depth buffering is turned off in the 3d object scene.

goofyseeker311 commented 8 months ago

how about extending java base classes like Color, to those objects to be directly usable.

goofyseeker311 commented 8 months ago

There are no double sided triangles right now, forced normal determination removed double sided triangle drawing, either by point winding order or giving a normal.

Loading transparent materials and colors separately using a known system works for making them one-sided transparent.

goofyseeker311 commented 8 months ago

SceneAntialiasing.BALANCED results sometimes in sawtooth cube edges even if it works most of the time for all triangles.

edit: does not depend on the SceneAntialiasing setting, triangles drawn far away at distance of 1000-10000+ with far clip distance of 1000000.0f will be saw tooth edged on the right side.

Lines made out of triangles (long thin cubes) are not affected by the long distance saw tooth edge effect. maybe anti-aliasing bug for non-line non-thin triangle surface edges.

goofyseeker311 commented 8 months ago

when the application thread locks the program say during an even, it will lock up windows explorer copy paste file transfer to white. yep a program should not by its own actions lock up the system, and only one core was used for the java app that locked up windows explorer.

goofyseeker311 commented 8 months ago

when putting jar libraries and binary files for linux in the root of the distribution jar file, it sometimes works and sometimes does not work, can launch, glass gtk load error.

running the app project in eclipse in linux works and probably also extracting the jar files next to the jar when running.

goofyseeker311 commented 8 months ago

why does an effect need to be set to null on a canvas, like coloradjust then to null, to prevent the effect from affecting all image types. I'm using canvas snapshot to get an image from totally off-screen canvas buffer that should not affect any other image or texture in any way. It's like canvas effect affects any other image if its not turned to null after using.

edit: coloradjust effect on MeshView is not working (in 3d transformed drawn triangles).

goofyseeker311 commented 8 months ago

there might be a threading/swing issue with other java stuff. there is 0.5sec stutter every 1-2sec even when dragging the main window when a non-javafx mainly math thread is running full speed (note: only one thread).

goofyseeker311 commented 8 months ago

frame pacing output is not smooth, even if scene minimal fast modifications are made with separate (daemon) timer at higher than 60Hz frequency.

goofyseeker311 commented 8 months ago

hue component of Color.hue is broken, no effect even if the input value changes from 0.0f to 1.0f, color is saturation brightness version of red always.

in degrees? color ranges should always be from 0.0f to 1.0f by definition, or if you want to follow the original Java Color definition of hue, which is 0.0f to 1.0f.

goofyseeker311 commented 8 months ago

Java process is left running (locking files) when all windows are closed even if Platform.setImplicitExit(true) holds.

You should not have to call System.exit(0); explicitly to get the Java spawned threads to also close on exit by default.

goofyseeker311 commented 8 months ago

There is no similar BlendMode as AlphaComposite.SRC.

GraphicsContext.clearRect seems to clear to opaque white and not to transparent black. clearRect "a transparent color" should be independent from any CSS features and not needing a scene to work properly.

Either PixelWriter will not put exactly Color.TRANSPARENT color in the canvas, or the canvas Node.snapshot will not output transparent image from the canvas. There should be a direct WritableImage output from the canvas if the Node.snapshot will not function properly as raster image output.

edit: Node.snapshot SnapshotParameters.setFill(Color.TRANSPARENT) fixed this issue.

goofyseeker311 commented 8 months ago

Node.setClip should be able to use any of the same nodes that are already used in the scene (without copying) to clip output image.

Especially 3D projection of 3d nodes (triangles) to 2D image should be able to be used as clip, or just enable mirror rendering from the JavaFX render engine.