Win a copy of Spring in Action (5th edition) this week in the Spring 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

javafx not working in Java 10  RSS feed

 
Ranch Hand
Posts: 1605
13
  • 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


 
Rancher
Posts: 3314
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
Ranch Hand
Posts: 1605
13
  • 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:

Error3, 26) java: package javafx.application does not exist
Error4, 20) java: package javafx.scene does not exist
Error5, 26) java: package javafx.scene.chart does not exist
Error6, 26) java: package javafx.scene.chart does not exist
Error7, 26) java: package javafx.scene.chart does not exist
Error8, 26) java: package javafx.scene.chart does not exist
Error9, 20) java: package javafx.stage does not exist
Error18, 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
Ranch Hand
Posts: 1605
13
  • 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]
 
Marshal
Posts: 61718
193
  • 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
Ranch Hand
Posts: 1605
13
  • 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,
 
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
Ranch Hand
Posts: 1605
13
  • 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
 
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!