Java 8 update 121 missing JavaFX Dialog and Alert classes? - javafx

I'm developing a JavaFX application and can't seem to import the Alert and Dialog classes that were released with Java 8 update 40 (Java 1.8.0_40). My version of Java is the newest version (1.8.0_121-b13). Did they remove Alert and Dialog from the latest version? How do I even find what classes are included in a specific Java release?
Here is my attempt to import:
import javafx.scene.control.Dialog;
It is okay up to the package control but cannot find the class Dialog.
Other information
Using Netbeans as my IDE
Project Properties:
Sources >> Source/Binary Format: JDK8
Sources >> Profile: Full JRE
Libraries >> Java Platform: JDK 1.8 (Default)

Thanks to James_D for helping me determine that I did actually have the classes on my hard disk (see the comments section of the original question). I then knew it was just a matter of configuring Netbeans properly. (Programming is not my main job so spending time trying to learn what all the settings & menus mean in the IDE is quite overwhelming right now, though I am learning bit by bit).
Anyway, I found what I needed under the menu:
Tools >> Java Platforms
Even though I have the latest JDK installed, this was still pointing to jdk1.8.0_20 which is pre-JavaFX Alert & Dialog classes.
Adding a new Java Platform and then going into Project Properties and setting it there fixed my issue.

Related

Unable to create a JavaFX project in Netbeans IDE 16 [duplicate]

I've been banging my head on this one for ages and all of the tutorials I've found don't seem to work. When I try to create a new JavaFX project in Netbeans 14, using JDK 18 and the latest JFX download for Windows here:
https://gluonhq.com/products/javafx/
Also tried with JDK and JFX 17 and still no luck. I get this error:
I've added the libraries like so:
If I try to add the platform folder, it won't let me progress through the dialogue:
I can't find solutions to this anywhere and, again this is the same with JDK 17 and 18, and JFX 17 and 18. I've checked the documentation and there's nothing that seems to solve the issue.
It says to go to the JavaFX tab and enable JavaFX, but there's no JavaFX tab... Unless they mean this:
But if that's it then, as you can see, it's already enabled and it's still not working. I'm totally lost. I don't understand why the documentation is so poor for FX, for every IDE. It's honestly like they don't want people to use it and every tutorial I'm finding is using outdated versions of NetBeans, the JDK and JFX D-: (they also don't solve the issue even if I do follow them).
If anyone could help guide me, I'd really appreciate it.
I would suggest you go to New Project -> Java with Maven -> either Simple JavaFX Maven Archetype(Gluon) or FXML JavaFX Maven Archetype(Gluon). Use the POM to change your version of JavaFX from the default to whatever version you like. I also use the POM to change the JavaFX-Maven-Plugin to the latest version.
I strongly endorse the approach using maven suggested here. This project started exactly the same way; I'd welcome learning of any issues you encounter.
Alternatively, follow the steps outlined in JavaFX and NetBeans: Non-modular projects: IDE. You've created a JavaFX library, but "Don't try to create a JavaFX project." Instead, choose Java with Ant and Java Application to create a new project, shown below, then follow the remaining steps carefully. It's a convenient alternative for a scratch project while you assay maven.
Addendum: The ant code for a JavaFX project, not selected in the image above, may attempt to package dependencies that are no longer required. In particular, a project using module javafx.web may fail with the following error, seen here and here. The easiest fix is to recreate the Java application by choosing Java Project with Existing Sources.
Unable to create javax script engine for javascript.
Alternatively, a simple example using a custom ant script is cited here.

BROWSER option is missing in view listener in a tree in JMeter

I have JDK 14 and JMeter 5.3 configured on my Windows 64 bit system But I don't see "Browser" option in "View Listeners in a Tree" in JMeter.
Any ways I can get it?
The easiest solution is just to downgrade to Oracle JDK 8 as it includes JavaFX package which is required for this Browser option to work.
However according to 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure you should always be using the latest version of JRE/JMeter so if you need to be able to render the response in the View Results Tree listener go for the following steps:
Download and install OpenJFX
Set PATH_TO_FX environment variable pointing to the OpenJFX installation folder
Restart JMeter - at this point you should see the Browser option
Browser option was removed due to missing JavaFX suppport
Bug 63355 - View Results Tree: Browser view option is not Available with Java 11
You can downgrade to Java 8 (which include library) or add Java FX library manually
Felix Schumacher:
You either have to downgrade to a Oracle Java -- which includes JavaFX, or you try to integrate JavaFX into a newer Java version. openjfx.io claims to have JavaFX versions for newer Java versions.

How to add javafx environment variable in Ubuntu now that the Oracle removed javafx from JDK?

I recently started learning javafx but now I came to know it was removed from the core JDK since java 11. I can't seem to find a way to compile javafx application. The import declaration is not working (I am using MVC design pattern). Is there a way to get around this?
I am using VS Code
Starting with Java 9, JavaFX was moved out of the JDK so that updates to JavaFX did not have to wait on the next JDK release (at least that's what I remember). When Ubuntu switched to JDK 11 from JDK 8, they added a new package "openjfx" that provides the JavaFX libraries.
So you have a couple of options to use JavaFX.
Install OpenJFX
sudo apt install openjfx libopenjfx-java
Setup Gradle Build
If you are using gradle to build, you can set it up to download whatever JavaFX version you want. Follow the instructions from openjfx for setting up a basic gradle configuration. The linked page has an example file you can start with.
You may also want to consider using Intellij Idea Community edition IDE instead of VS Code. I think VS Code is excellent and have used it for a couple of years now including for JavaFX development. I recently switched to Intellij and the features it provides for java development are step above VS Code. Plus it's provided as a snap so easy to install:
snap install intellij-idea-community --classic
So, about the environment variable. I'm guessing you are on Linux, so you have two ways of setting it:
A) set it for current session;
B) set it globally.
Option A: open the Terminal and execute export PATH_TO_FX=[absolute path to Javafx folder]/lib. This will create a variable for your current user for the current session only - you will have to execute it every time you boot your OS.
Option B: locate the file /etc/profile; then back it up; then open it for editing and add the export PATH_TO_FX="[absolute path to Javafx folder]/lib" line to the end of it. Save the file and restart your system. This way the variable will be preserved for all users permanently.
Finally, test the Javafx presence by launching your application jar - java -jar --module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml your.jar (or launch your main class as shown in the documentation).

JavaFX Projects gone?

I have been trying to find a place to download the plugin, allowing the creation of JavaFX projects, but without success.
I have installed the newest Java SDK8u65-windows-x64 but it doesn't support JavaFX Projects, or at least I couldn't figure how to create one!
Does anyone know if they have temporally taken the url's where we used to be able to download JavaFX plugins from, or is it only me, who can't find them on the Oracle website?
Thank you !
EDIT: The problem was, that I was using Eclipse Mars, which for some reason doesn't allow to auto import JavaFx, as it has some odd access restrictions on the JRE system library. How I solved it was I installed the e(fx)clipse plugin and I was able to import javafx components successfully after that!
You can develop JavaFx straight away if you are using intellij Idea and perhaps some other ides
But if you are using eclipse, you should install the e(fx)clipse for your version.
Try this link
Also if you have more than one JDKs on your system, try to use jdk 8 an the default
Right click your project > properties
Then elect “Java Build Path” on left, then “JRE System Library”, click Edit…
Select "Workspace Default JRE"
Click "Installed JREs"
Check out the list and select jdk 8....
If you don't see it, click Search…, navigate to your jdk8 path, then click OK
Now you should see all installed JREs, select the one you want
Click OK

JavaFX JDK not found

I'm trying to install JavaFX for the first time and it says that version 1.6.0 or higher is required but none found. Also when I load a JavaFX app in firefox or chrome it says it can't find Java. This is strange since I have 1.6.0_07-b06 installed and I actively use it for development.
Is there a certain place JavaFX looks? Is this a bug?
thanks,
Jeff
I believe Sun recommends Java versions later than Java 6 update 10 for JavaFX as it takes advantage of the new applet re-working and various other bits. Try upgrading.
Let me know if that doesn't fix your problem.
are u on windows? if so make sure the environment variable > PATH includes the path to the latest java instead of some old one

Resources