java有包构建找不到,找不到JavaFX包

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;

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

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:

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

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.

解决方案

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.

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值