首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Javafx教程4无法编译

Javafx教程4无法编译
EN

Stack Overflow用户
提问于 2013-04-07 06:23:24
回答 1查看 520关注 0票数 0

Here is the tutorial link

我一直在关注javafx使用e(fx)clipse的教程,但我不能启动这个教程。我的代码与他们的完全相同,如果我使用Netbeans,它就可以工作,但是我在eclipse中得到了这个错误:

代码语言:javascript
运行
复制
java.lang.ClassNotFoundException: fxmlexample.FXMLExampleController
/C:/Users/Michael/workspace/JavaFX%20Test/bin/fxmltest/fxml_example.fxml:10
  at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:726)
  at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:775)
  at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:180)
  at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:563)
  at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2314)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2131)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2744)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2723)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2709)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2696)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2685)
  at fxmltest.FXMLExample.start(FXMLExample.java:17)
  at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
  at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:215)
  at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
  at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
  at java.security.AccessController.doPrivileged(Native Method)
  at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
  at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
  at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
  at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
  at java.lang.Thread.run(Unknown Source)
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
    at java.lang.Thread.run(Unknown Source)
Caused by: javafx.fxml.LoadException: java.lang.ClassNotFoundException: fxmlexample.FXMLExampleController
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:726)
    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:775)
    at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:180)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:563)
    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2314)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2131)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2744)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2723)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2709)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2696)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2685)
    at fxmltest.FXMLExample.start(FXMLExample.java:17)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:215)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    ... 1 more
Caused by: java.lang.ClassNotFoundException: fxmlexample.FXMLExampleController
    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)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:724)
    ... 22 more

有没有人有什么解决方案可以让它和eclipse一起工作?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-07 07:13:55

好吧,我知道我做错了什么。Netbeans会自动创建一个名为项目名称的包,所以当我添加控制器fxmlexample.FXMLExampleController时,它会在包fxmlexample中查找,我只是使用了缺省包。

只需创建一个名为fxmlexample的包并将我的文件移动到其中就可以解决这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15856704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档