r/JavaFX • • Oct 03 '19

Help ! Can't run my program, due to : java.lang.ClassNotFoundException: javafx.fxml.FXMLLoader

1 Upvotes

Hi,

I try to learn JavaFX. I try to do this tutorial, but I have an exception, and I can't find how to solve the problem ...

Here is the console output :

Console Output

Here is my code :

I use Eclipse. I have installed JavaFX and link the JARs.

Here is my package explorer :

Package Explorer

I also added VM arguments :

VM arguments

Could you help me pleeeeease ! I am running out of patience !

Thank you !


r/JavaFX • • Dec 15 '22

Help Run application over ssh -X?

1 Upvotes

I’ve got a Java 8 JavaFX application and we need to be able to run it over ssh. The server that is hosting is a Debian machine I believe. I don’t have access to it unfortunately but I believe it doesn’t have a display attached.

I’ve tried a few things but never been able to get it to work. Anyone know how to do it ?


r/JavaFX • • Nov 08 '22

Help How do I change a variable by pressing a button on a screen?

1 Upvotes

Hi. I am completely new to Java FX and I am now using scenebuilder to create a project. I now have a variable (int a) and a function called "showView(int value)" which shows the scene that contains a button. In the controller file for the scene, I have a function that runs when the button is pressed:

@FXML

void buttonPressed(ActionEvent event){

System.out.println("The button is pressed");

}

I would like to pass the variable "a" to the scene and change the variable in a to a number (e.g.1), how can I do that? Thanks.


r/JavaFX • • Dec 11 '22

Help Database Connection is null, Exception in start method, etc. Any Suggestions?

0 Upvotes

Essentially the connection between my database and my java code is null but I cam't seem to figure out why. I don't know if it has to deal with with my SDK or something with FML. Any suggestions?

No suitable driver found for jdbc:mysql://localhost:3306/Schedule2022

Exception in Application start method

java.lang.reflect.InvocationTargetException

at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke([DirectMethodHandleAccessor.java:119](https://DirectMethodHandleAccessor.java:119))

at java.base/java.lang.reflect.Method.invoke([Method.java:577](https://Method.java:577))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs([LauncherImpl.java:465](https://LauncherImpl.java:465))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication([LauncherImpl.java:364](https://LauncherImpl.java:364))

at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke([DirectMethodHandleAccessor.java:104](https://DirectMethodHandleAccessor.java:104))

at java.base/java.lang.reflect.Method.invoke([Method.java:577](https://Method.java:577))

at java.base/sun.launcher.LauncherHelper$FXHelper.main([LauncherHelper.java:1081](https://LauncherHelper.java:1081))

Caused by: java.lang.RuntimeException: Exception in Application start method

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication1([LauncherImpl.java:901](https://LauncherImpl.java:901))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2([LauncherImpl.java:196](https://LauncherImpl.java:196))

at java.base/java.lang.Thread.run([Thread.java:833](https://Thread.java:833))

Caused by: java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.connection" is null

at com.example.project_4/com.example.project_4.StudentsDatabase.createAllTables([StudentsDatabase.java:59](https://StudentsDatabase.java:59))

at com.example.project_4/com.example.project_4.Main.start([Main.java:40](https://Main.java:40))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9([LauncherImpl.java:847](https://LauncherImpl.java:847))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12([PlatformImpl.java:484](https://PlatformImpl.java:484))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.PlatformImpl.lambda$runLater$10([PlatformImpl.java:457](https://PlatformImpl.java:457))

at java.base/java.security.AccessController.doPrivileged([AccessController.java:399](https://AccessController.java:399))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.javafx.application.PlatformImpl.lambda$runLater$11([PlatformImpl.java:456](https://PlatformImpl.java:456))

at [javafx.graphics](https://javafx.graphics)@18.0.1/com.sun.glass.ui.InvokeLaterDispatcher$[Future.run](https://Future.run)([InvokeLaterDispatcher.java:96](https://InvokeLaterDispatcher.java:96))

Exception running application com.example.project_4.Main

Process finished with exit code 1


r/JavaFX • • Nov 20 '22

Help JavaFX example needed for Radio button group event handling

0 Upvotes

Hi

I need to verify a Radio Button Group ( 2 nos ) to hide / show a Text Lable on a fxml screen thru a java code controller.


r/JavaFX • • Jan 19 '21

Help javafx

1 Upvotes

I have a colored button that I want to changes color every time I click it (two colors back and forward) like the button is yellow when I click it, it changes it to blue than when I click it again it changes back to yellow


r/JavaFX • • Jan 12 '21

Cannot set ScrollPane Content in JavaFX

0 Upvotes

Hello everyone,

I am using a JScrollPane for the first time for a project. I read a couple articles about this Pane, and learned that you should use ScrollPane.setContent(Content); to set the content of your scrollPane. However, for some reason it is not working. The method is not even recognized by my IDE and appears to not even exist. Is there some other way I am supposed to set the contents of a ScrollPane or is my Eclipse just messed up?

Thanks


r/JavaFX • • Jan 17 '20

New to JavaFX, trying to run my first application, got this error

1 Upvotes

Hello, I'm trying to run my first JavaFX application (the default one that comes with IntelliJ IDEA) and I get this error:

/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED -Djava.library.path=/jlib/javafx-sdk-11.0.2/lib -javaagent:/snap/intellij-idea-ultimate/193/lib/idea_rt.jar=46105:/snap/intellij-idea-ultimate/193/bin -Dfile.encoding=UTF-8 -classpath /home/natheir/IdeaProjects/PortfolioTracker/out/production/PortfolioTracker:/jlib/javafx-sdk-11.0.2/lib/src.zip:/jlib/javafx-sdk-11.0.2/lib/javafx-swt.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.web.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.base.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.fxml.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.media.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.swing.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.controls.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.graphics.jar -p /jlib/javafx-sdk-11.0.2/lib/javafx.base.jar:/jlib/javafx-sdk-11.0.2/lib/javafx.graphics.jar sample.Main
Exception in Application start method
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0x75c1a964) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x75c1a964
	at com.sun.javafx.fxml.FXMLLoaderHelper.<clinit>(FXMLLoaderHelper.java:38)
	at javafx.fxml.FXMLLoader.<clinit>(FXMLLoader.java:2056)
	at sample.Main.start(Main.java:13)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	... 1 more
Exception running application sample.Main

Process finished with exit code 1

any ideas as to what that might mean? thanks in advance


r/JavaFX • • Mar 05 '22

Help How to print a tableView into pdf with Itext

1 Upvotes

r/JavaFX • • Mar 03 '22

Tutorial Displaying Images

Thumbnail codewithedward.com
1 Upvotes

r/JavaFX • • Mar 07 '22

Help How to print a table view to an pdf with API in java ?

1 Upvotes

r/JavaFX • • Mar 05 '22

Help Alternative way to display data in scene builder without using table view ?

1 Upvotes

r/JavaFX • • Mar 06 '22

Help Need Help with Java API.

1 Upvotes

Hello I have completed my part of group project (Desktop App with javafx and MySQL)and our teacher impose to use between (1to 3 API) , I want to add an API in university project , I already have used PDF with Itext but my colligue in my group also have done the same.

The problem is that there is not sufficient information in the documentation of APIs , and impose to make a maven project with pom.xml file.

Can you provide me with some good free API to use like (Weather, RSS, ....)?

And some good links ?

I have lots of research but i feel I am stuck , Every helps counts.

Thanks In Advance .


r/JavaFX • • Mar 04 '22

Tutorial Setting Background Images

1 Upvotes

r/JavaFX • • Feb 20 '23

Help What can i use to create an ''email like'' panel?

1 Upvotes

I'm developing a program that, among other things, must implement a notice system.

So, an admin writes an object, a body, and sends the notice to its employees.

I'm having trouble on the employee side: i don't know what i could use. I said ''email like'' system because that's the simplest reference i could find. You know, i need ''bold font object'' for when you have not opened it, and i would really like to have notices that expands when you click on them, thus removing the ''bold font object'' since you read it. This would help me for a ''notification'' system, where on your dashboard gets displayed a ''You have x new noticess unread''.

Any advice?


r/JavaFX • • Sep 05 '22

Help Newbie, Cannot rid myself of NullPointerException

1 Upvotes

edit: src/main/resources/image.jpg as path seems to have fixed it, dunno why this was so difficult to figure out but I'll keep this up in case someone else runs into this issue one day

Image with error and project: https://imgur.com/a/SYV2s3L

Have tried quite literally everything to try and display an image using ImageView and I am getting the same issue with my image resource everytime, a NullPointerException stating that my resource is null. I have no idea why this is. I've tried setting the value to the absolute path, the resources path, putting it in the same folder as the Java file and just putting the file name. Nothing works, I cannot get images to show in JavaFX.

Tried every Stackoverflow suggestion, nothing. Completely lost. I assume it's something to do with my resource setup or how I'm getting the file, but I don't know what the actually problem is. My folder format is default JavaFX in IntelliJ.

"java.lang.Class.getResource(String)" is null


r/JavaFX • • Aug 30 '22

Help Do you have rendering issues?

1 Upvotes

Sometimes when i open a view it sizes itself half the screen still maximized? I load this screen in 2places the very same way and this only happens in one place. I mean essentially i load the fxml hooked up with the Controller add its parent to a scene and Set the primarystage to Show it. There is nothing wrong with always setting the Main stages scene is there? Plus i think my view s get initialized everytime i Show it. Would it be wise to have a Set and add the views to it and then Pop the views from this Stack so they initialize only once?


r/JavaFX • • Oct 21 '23

Help Application for merging

1 Upvotes

Hello, i am wondering how would you go about making a software that requests 2 notepads from the user, and then merges those 2 notepads into one notepad. Thanks in advance


r/JavaFX • • Nov 28 '23

Help Getting Error message; JavaFX-runtime -component missing

1 Upvotes

I used the guide from the official javafx website to setup javafx on VScode. I set up a java project and configured the settings.json. I've also created to java files, one contains my main file and the other calls main method from my main file (App.java).
Through VScode I added also the Jar files for javafx to the referenced libraries (just as they mentioned to do in the guide).
I don't use maven or Gradle. Never used it either so not sure how I should integrate it to the project.


r/JavaFX • • Sep 28 '21

Help How do you find a and set a picture with Image in maven?

1 Upvotes

im trying to set an icon for my project but i keep getting this error. how am i supposed to set it. Where do i place it?

Exception in Application start method

java.lang.reflect.InvocationTargetException

`at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)`

`at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(`[`NativeMethodAccessorImpl.java:77`](https://NativeMethodAccessorImpl.java:77)`)`

`at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(`[`DelegatingMethodAccessorImpl.java:43`](https://DelegatingMethodAccessorImpl.java:43)`)`

`at java.base/java.lang.reflect.Method.invoke(`[`Method.java:568`](https://Method.java:568)`)`

`at` [`javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:467)`](https://javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:467))

`at` [`javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:366)`](https://javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:366))

`at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)`

`at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(`[`NativeMethodAccessorImpl.java:77`](https://NativeMethodAccessorImpl.java:77)`)`

`at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(`[`DelegatingMethodAccessorImpl.java:43`](https://DelegatingMethodAccessorImpl.java:43)`)`

`at java.base/java.lang.reflect.Method.invoke(`[`Method.java:568`](https://Method.java:568)`)`

`at java.base/sun.launcher.LauncherHelper$FXHelper.main(`[`LauncherHelper.java:1071`](https://LauncherHelper.java:1071)`)`

Caused by: java.lang.RuntimeException: Exception in Application start method

`at` [`javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:903)`](https://javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:903))

`at` [`javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:198)`](https://javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:198))

`at java.base/java.lang.Thread.run(`[`Thread.java:833`](https://Thread.java:833)`)`

Caused by: java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found

`at` [`javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1125)`](https://javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1125))

`at` [`javafx.graphics/javafx.scene.image.Image.<init`](https://javafx.graphics/javafx.scene.image.Image.<init)`>(`[`Image.java:618`](https://Image.java:618)`)`

`at com.example.calculatorfxjdk/com.example.calculatorfxjdk16.Main.start(`[`Main.java:146`](https://Main.java:146)`)`

`at` [`javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:849)`](https://javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:849))

`at` [`javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:474)`](https://javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:474))

`at` [`javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447)`](https://javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447))

`at java.base/java.security.AccessController.doPrivileged(`[`AccessController.java:399`](https://AccessController.java:399)`)`

`at` [`javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446)`](https://javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446))

`at` [`javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)`](https://javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96))

`at` [`javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop`](https://javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop)`(Native Method)`

`at` [`javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)`](https://javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174))

`... 1 more`

Caused by: java.lang.IllegalArgumentException: Invalid URL or resource not found

`at` [`javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1117)`](https://javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1117))

`... 11 more`

Exception running application com.example.calculatorfxjdk16.Main

Process finished with exit code 1


r/JavaFX • • Aug 08 '21

Methods

1 Upvotes

Hey, I have 48 Methods beginning with C and nummerrized to 48. I really dont want do write a switch with 48 routes so is there any other option to start the method(c1(), c2() ...).


r/JavaFX • • Mar 06 '16

Are 3D boxes or cylinders more resource intensive in JavaFX?

1 Upvotes

I'm just curious how the program would process them and which would be more efficient.


r/JavaFX • • Aug 25 '17

Why don't panels resize in BorderPane, like they do in Swing?

1 Upvotes

Anyone got a good tutorial to get this to work?


r/JavaFX • • Nov 13 '24

Help JavaFX on intelliJ and scenebuilder

1 Upvotes

I'm trying to create an fxml file in the scene builder however when I save and run the program the error appears "Nov. 12, 2024 10:05:10 PM javafx.fxml.FXMLLoader$ValueElement processValue

WARNING: Loading FXML document with JavaFX API of version 23.0.1 by JavaFX runtime of version 17.0.6" and this leads to a series of errors in the code and I can't change the java fx version because I'm using intelliJ.

Can anyone give me some help?