尝试运行javaFX应用程序时缺少javax.inject

时间:2015-01-29 14:23:14

标签: javafx inject

在尝试运行我的javaFX应用程序时,我得到了以下stacktrace,如何解决这个问题?究竟是什么导致了这个问题?除了旧的dataFX lib之外,我还没有删除任何东西。我正在使用eclipse与最新版本的java和javaFX插件。

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

1 个答案:

答案 0 :(得分:2)

javax.inject是一个JavaEE框架,它不包含在JavaSE 8发行版中。您将需要一个与项目捆绑在一起的附加库,其中包含一个javax.inject实现。我相信afterburner.fx是JavaFX的瘦框架示例,其中包含javax.inject实现。