Android Studio doesn't have JavaFX?

Does Android Studio's default JDK include JavaFX?

 

In other post(the below URL), AS3.0 should include the new runtime with JavaFX, but my plugin has error on AS 3.2 now.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000698570-JavaFX-for-Android-Studio-plugin?page=1#community_comment_115000588790

 

The Error message is this.

java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel

 

If Android Studio's default JDK doesn't include JavaFX, I may have to include it to my plugin...

 

0
6 comments

My plugin uses JavaFX and runs on AS 3.0 and AS 3.2 without issues. Your issue is probably with the JRE which is used to run AS. Check which JRE it is running on and see if jfxrt.jar is found in Contents/Home/jre/lib/ext of the JRE installation directory.

0
Avatar
Permanently deleted user

Vladimir Scheneider

 

Thank you for your reply.

 

But AS3.2(for MAC)'s default JRE is inside AS.

/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/jre

 

This is default setting and recommended setting.

 

And there is no jfxrt.jar in this path.

➜  ext pwd
/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/ext
➜ ext ls
cldrdata.jar localedata.jar sunec.jar zipfs.jar
dnsns.jar meta-index sunjce_provider.jar
jaccess.jar nashorn.jar sunpkcs11.jar

 

So, I think if your plugin can use on AS, it may be because you use not Mac AS? or you changed settings of AS, or only AS3.2 for Mac doesn't have JavaFX?

 

I'm using JavaFX in my plugin so I need to fix this problem...

 

0

My bad. You are right, I am running on a JRE with JavaFX not the bundled JRE. I changed the boot JDK a while back and forgot about it.

The bundled JRE does not have JavaFX libraries.

I use a hybrid JRE. A combination of the bundled JRE with missing files filled in from Oracle JRE. That way I can have the improved font rendering and bug fixes of the bundled JRE but with JavaFX. An old blog about doing it https://vladsch.com/blog/12 should still be valid.

However, the plugin will only work for those that change the boot JRE for AS.

0
Avatar
Permanently deleted user

I'm running AS on Mac with the following configurations:


Android Studio 3.5.3
Build #AI-191.8026.42.35.6010548, built on November 15, 2019
JRE: 1.8.0_202-release-1483-b49-5587405 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.1

and my JAVA_HOME is:

 /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/ 

where jfxrt.jar exists:

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

and when I want to use an IDE plug-in that requires JavaFX, it tells me it couldn't instantiate and I should launch AS with JavaFX bundled

Any idea why?

0

Android Studio is using:

JRE: 1.8.0_202-release-1483-b49-5587405 x86_64


Not your JAVA_HOME JRE. Also JDK 1.8.0_40 support for JavaFX is really flaky with lots of bugs and JVM crashes. I would not use it today. The easiest way is probably to switch to a JetBrains JRE with JavaFX. You can download them from  https://bintray.com/jetbrains/intellij-jbr I usually get the JDK instead of the JRE and prefer to use the same version as the bundled JRE.

Expand the download to /Library/Java/JavaVirtualMachines subdirectory and then set the IDE JRE to it. The IDE will use it and you will have JavaFX.

0
Avatar
Permanently deleted user

Thanks for your help Vladimir ;)

0

Please sign in to leave a comment.