This week's book giveaway is in the XML and Related Technologies forum.
We're giving away four copies of Java XML & JSON and have Jeff Friesen on-line!
See this thread for details.
Win a copy of Java XML & JSON this week in the XML and Related Technologies forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

javafx not working in Java 10  RSS feed

 
Mike London
Bartender
Posts: 1634
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code below compiles. I get method drop downs, etc., but when I try to run it in Java 10, I get symbol not found for all the JavaFX classes (Application, scene, etc.).

Supposedly, it won't be until JDK 11 this September (2018) when Oracle removes JavaFX from the standard JDK.

What do I need to do to get this simple code to run as in Java 8?

The example below is a simple example. I also downloaded an example from the Oracle site with the same errors.

Thanks,

- mike


 
Norm Radder
Rancher
Posts: 3353
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

when I try to run it in Java 10


What do you mean by "run"?  
Are the errors from compiling
or from executing the compiled code?

I get symbol not found  


Can you copy the full text of the error messages and paste it here?
 
Mike London
Bartender
Posts: 1634
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Norm Radder wrote:

when I try to run it in Java 10


What do you mean by "run"?  
Are the errors from compiling
or from executing the compiled code?

I get symbol not found  


Can you copy the full text of the error messages and paste it here?



I guess I should have said that the program "appears" to compile. That is, in Intellij, there are no errors in the editor. I can click an object and the "." and see available methods.

Yet, if I do try to re-compile the code, I get errors including these:

Error:(3, 26) java: package javafx.application does not exist
Error:(4, 20) java: package javafx.scene does not exist
Error:(5, 26) java: package javafx.scene.chart does not exist
Error:(6, 26) java: package javafx.scene.chart does not exist
Error:(7, 26) java: package javafx.scene.chart does not exist
Error:(8, 26) java: package javafx.scene.chart does not exist
Error:(9, 20) java: package javafx.stage does not exist
Error:(18, 38) java: cannot find symbol
 symbol: class Application
.
.
.

The confusing thing is that, as I noted above (see attachment), the method drop-downs are working so I'm baffled why the code won't compile.

Thanks in advance,

- mike
method-drop-downs-working.png
[Thumbnail for method-drop-downs-working.png]
 
Mike London
Bartender
Posts: 1634
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To fix this issue, I had to manually add the JavaFX JAR file from Java 8 to the project.

/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/lib/ext/jfxrt.jar

It's strange, but there isn't even a "jre" folder in the JDK 10 install (see attachment).

Similarly, doing a "locate" shows no jfxrt.jar in the JDK 10 install elsewhere.

Don't get what happened.

Thanks,

-- mike
no-javafx-jar-file.png
[Thumbnail for no-javafx-jar-file.png]
 
Campbell Ritchie
Marshal
Posts: 62803
203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code compiled and ran without changes at my terminal:-The warning is about you using Data as a raw type. JavaFX has been included with the standard JDK download since (I think) Java8, four years ago. Please check whether there is an error with your IntelliJ settings. I shall add this discussion to the IntelliJ forum
 
Mike London
Bartender
Posts: 1634
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Your code compiled and ran without changes at my terminal:-The warning is about you using Data as a raw type. JavaFX has been included with the standard JDK download since (I think) Java8, four years ago. Please check whether there is an error with your IntelliJ settings. I shall add this discussion to the IntelliJ forum



Yes, I create a new project and it worked fine.

This was my goof.

In Intellij, under language levels, I didn't have the correct "language level".

It's fixed now.

FWIW, the problem happened as I was trying to find a library that was causing Intelilj (Java 10) to run out of Heap Space during running so I was doing lots of fiddling around.

Thanks very much for the replies!

- mike

Thanks,
 
sonai kale
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use ubuntu 16.04 and because I already had openJDK installed, this command have solved the problem. sudo apt-get install openjfx  Don't forget that JavaFX is part of OpenJDK.

 
Mike London
Bartender
Posts: 1634
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

sonai kale wrote:I use ubuntu 16.04 and because I already had openJDK installed, this command have solved the problem. sudo apt-get install openjfx  Don't forget that JavaFX is part of OpenJDK.



Hi,

As I noted my my latest reply above, the issue was fixed.

Thanks,

- mike
 
Mahboub Hejazi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,

I have the same problem. Can you please walk me through to fix that? Thanks.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!