11

I'm trying to set up IntelliJ IDEA with screenbuilder and JavaFX and scenebuilder. I have both instealled, but when I create a new JavaFX project, open the fxml file, and switch to the scenebuilder tab, I get a very long error message in place of the scenebuilder UI:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderCreatorImpl.create(SceneBuilderCreatorImpl.java:35)
    at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderEditor.addSceneBuilder(SceneBuilderEditor.java:204)
    at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderEditor.access$700(SceneBuilderEditor.java:34)
    at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderEditor$ExternalChangeListener.checkContent(SceneBuilderEditor.java:338)
    at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderEditor.initSceneBuilder(SceneBuilderEditor.java:180)
    at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderEditor.selectNotify(SceneBuilderEditor.java:252)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl$10.run(FileEditorManagerImpl.java:875)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:702)
    at java.awt.EventQueue$3.run(EventQueue.java:696)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:748)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:577)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:832)
    at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:208)
    at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:660)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:418)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:413)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:366)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:456)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:544)
    at com.intellij.ide.impl.ProjectUtil.openProject(ProjectUtil.java:181)
    at com.intellij.ide.RecentProjectsManager.doOpenProject(RecentProjectsManager.java:46)
    at com.intellij.ide.RecentProjectsManagerBase.doReopenLastProject(RecentProjectsManagerBase.java:340)
    at com.intellij.ide.RecentProjectsManagerBase$MyAppLifecycleListener.appStarting(RecentProjectsManagerBase.java:367)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:114)
    at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:315)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:302)
    at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:287)
    at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:41)
    at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:177)
    at com.sun.proxy.$Proxy45.appStarting(Unknown Source)
    at com.intellij.idea.IdeaApplication.loadProject(IdeaApplication.java:306)
    at com.intellij.idea.IdeaApplication.access$500(IdeaApplication.java:55)
    at com.intellij.idea.IdeaApplication$IdeStarter$2.run(IdeaApplication.java:280)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:318)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:702)
    at java.awt.EventQueue$3.run(EventQueue.java:696)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:748)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:577)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NoClassDefFoundError: javafx/fxml/FXMLLoader
    at org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderKitWrapper.create(SceneBuilderKitWrapper.java:19)
    ... 66 more

I think something is misconfgured, but I'm not sure what to check. Could someone please point me in the right direction?

Vampire
  • 35,631
  • 4
  • 76
  • 102
Unsolved Cypher
  • 1,025
  • 10
  • 24
  • 1
    Please try deleting and recreating the JDK that you use in your project. – yole Feb 19 '15 at 20:14
  • @yole as in uninstalling and reinstalling it, or something else? – Unsolved Cypher Feb 19 '15 at 21:30
  • 2
    As in removing the JDK in the Project Structure dialog and then adding it back. – yole Feb 20 '15 at 08:19
  • 1
    @yole I have the same problem. :-( – Vampire Jul 17 '15 at 11:09
  • 1
    same problem here. Removing the jdk and adding it back doesn't help – L. Blanc Feb 08 '16 at 20:28
  • FYI: Intellij bug tracker link for the unusable fonts in SceneBuilder on Mac when embedded in Idea [IDEA-266524](https://youtrack.jetbrains.com/issue/IDEA-266524), replicated on Mac OS (10.15), Scene Builder inside IntelliJ (2021.2 UE). Hopefully, Intellij will fix the linked bug so that Scene Builder becomes useable when embedded in Idea on a Mac. – jewelsea Sep 02 '21 at 20:28

2 Answers2

22

I had the same problem and it was caused by intellij's bundeled jdk in my case. Try to switch the ide's jdk as show here to oracle jdk 8 for example which contains all the needed classes.

Vaduva Tibi
  • 321
  • 2
  • 3
1

You have to add the file idea.jdk on ~/.IntelliJIdea2016.1/config folder.

Add the Oracle JDK path like /usr/java/jdk1.8.0_73