1
这里是我的问题: 我正在开发一个应该启动Javafx应用程序的Eclipse插件。实际上应该很容易,但我仍然有问题。 这里我的代码,例如,对于简单的FX-应用:Eclipse插件执行Javafx应用程序
public class UIContainer extends Application{
public static void main(String[] args){
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("First FXML Example");
Pane myPane = (Pane)FXMLLoader.load(getClass().getResource("gui.fxml"));
Scene myScene = new Scene(myPane);
primaryStage.setScene(myScene);
primaryStage.show();
}
现在我想从运行一个Eclipse插件处理程序这样的应用程序:
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
//Call the UIContainer here
//do sth. else
return null;
}
有实际上是在调用无差异根据错误消息,通过主方法或开始方法应用。
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javafx/application/Application
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
...
Caused by: java.lang.ClassNotFoundException: javafx.application.Application cannot be found by XODR-Validator_0.0.1.qualifier
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 60 more
希望您可以跟踪我的问题,以便找到解决方案。
我的配置: Eclipse的开普勒(IDE为EE开发者) JDK1.7.0_40
提前感谢!
它应该在按下菜单项后启动。 基于Eclipse-Plugin默认为SWT的事实,我应该联系FXCanvas,对吧? 谢谢,我会试试那个。 – Nick
好吧,如果它只是一个对话框,那么是的 - 你最好将它实现为一个JFace-Dialog或一个SWT-Shell在FXCanvas中持有FX-Content,但我不确定你的用例是什么。 无论如何,当你在OSGi中时,你将不得不使用e(fx)clipse,否则你将无法找到Java7中不在类路径上的javafx-libs,重新封装产品中的FX会导致失败(请参阅http://tomsondev.bestsolution.at/2012/08/01/javafx-2-2-and-osgi/) – tomsontom
外汇不是强制性的,但会很好用。无论如何,我会尝试将其包装到SWT壳中。 – Nick