找不到JavaFX包

编程入门 行业动态 更新时间:2024-10-24 18:25:03
本文介绍了找不到JavaFX包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用组合的Swing和JavaFX组件创建一个项目,但我的IDE找不到JavaFX包(尝试使用Netbeans和Eclipse)。

I am trying to make a project with combined Swing and JavaFX components but JavaFX packages are not found by my IDE (tried with Netbeans and Eclipse).

import javafx.embed.swing.JFXPanel;

说包javafx.embed.swing.JFXPanel不存在,对于任何其他fx包都是一样的。

says package javafx.embed.swing.JFXPanel does not exist, same for any other fx packages.

当我使用 new project>创建项目时会发生这种情况。 java应用程序,但如果我尝试创建JavaFX示例,它可以工作......

This happens when I create project using new project > java application, but if I try to create JavaFX sample, it works...

我不知道我在这里缺少什么。以下是我尝试过的一些背景信息和步骤:

I have no idea what am I missing here. Here are some background information and steps I have tried:

  • 我使用的是win7和jdk7(其中应包含java FX)
  • 我在Netbeans中的项目(版本8)已选择JDK 1.7作为deafult库
  • 我更新了我的路径: JAVA_HOME:C :\Program Files \ Java * \\ jre7
  • 还有系统路径:%SystemRoot%\ system32;%SystemRoot% ;%SystemRoot%\ System32 \ Wbem;%SYSTEMROOT%\System32 \ WindowsPowerShell \v1.0 \; C:\Program Files \ Intel \ DMIX; C:\Program Files \ Java \ _jdk1.7.0_17 \\\\; C:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ .7.0_17\jre\lib\jfxrt.jar
  • I am using win7 and jdk7 (in which java FX should be included)
  • My project in Netbeans (version 8) has JDK 1.7 selected as a deafult library
  • I updated my path: JAVA_HOME: C:\Program Files\Java\jre7
  • And also system Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\DMIX;C:\Program Files\Java\jdk1.7.0_17\jre\bin;C:\Dev\ant\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0_17\jre\lib\jfxrt.jar
  • 我还应该做些什么呢?使JavaFX工作?感谢您的任何疑难解答...到目前为止,有关设置JavaFX的所有信息似乎都已过时。

    What else should I do to make JavaFX work? Thanks for any troubleshooting... All the information about setting JavaFX so far seem to be very outdated.

    推荐答案

    您必须包括IDE中的项目 jfxrt.jar 否则将不包括它,因为这是Java 8之前的默认行为。

    You must include in the Project in your IDE the jfxrt.jar otherwise it will not be included as this was the default behavior prior to Java 8.

    然后,根据您的系统和为您的项目构建jar的方式,它也必须在那里运行 jar 。因此,让您的项目也导出所需的库。

    Then depending on your system and the way your build your jar for your project, and it also must be there for running the jar. So make your project also export the required libraries.

    更多推荐

    找不到JavaFX包

    本文发布于:2023-11-16 13:02:28,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1604518.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:找不到   JavaFX

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!