Recusiwe
Recusiwe

Reputation: 1140

Missing javax.inject when trying to run a javaFX application

I got the following stacktrace when trying to run my javaFX application, how to fix this? What is actually causing the problem? I haven't removed anything other than an old dataFX lib. I am using eclipse with the latest version of java, and the javaFX plugin.

Exception in Application start method

java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)

at com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)

Caused by: java.lang.RuntimeException: Exception in Application start method

at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(Unknown Source)

at com.sun.javafx.application.LauncherImpl$$Lambda$48/1732398722.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NoClassDefFoundError: javax/inject/Inject

at io.datafx.controller.injection.InjectResourceType.getSupportedAnnotation(InjectResourceType.java:55)

at io.datafx.controller.context.ContextResolver.getAnnotatedControllerResourceTypes(ContextResolver.java:87)

at io.datafx.controller.context.ContextResolver.injectResources(ContextResolver.java:49)

at io.datafx.controller.ViewFactory.createByController(ViewFactory.java:171)

at io.datafx.controller.flow.FlowHandler.start(FlowHandler.java:140)

at io.datafx.controller.flow.Flow.startInStage(Flow.java:406)

at application.MainApp.start(MainApp.java:16)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(Unknown Source)

at com.sun.javafx.application.LauncherImpl$$Lambda$51/1285177093.run(Unknown Source)

at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(Unknown Source)

at com.sun.javafx.application.PlatformImpl$$Lambda$45/1051754451.run(Unknown Source)

at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source)

at com.sun.javafx.application.PlatformImpl$$Lambda$47/483857893.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source)

at com.sun.javafx.application.PlatformImpl$$Lambda$46/1775282465.run(Unknown Source)

at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)

at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source)

at com.sun.glass.ui.win.WinApplication$$Lambda$37/1109371569.run(Unknown Source)

... 1 more

Caused by: java.lang.ClassNotFoundException: javax.inject.Inject

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 21 more

Exception running application application.MainApp

Upvotes: 2

Views: 365

Answers (1)

jewelsea
jewelsea

Reputation: 159416

javax.inject is a JavaEE framework, it is not included in a JavaSE 8 distribution. You will need an additional library bundled with your project which includes a javax.inject implementation. I believe afterburner.fx is an example of a thin framework for JavaFX which includes a javax.inject implementation.

Upvotes: 2

Related Questions