Eclipse / Java9:如何访问内部javafx包? [英] Eclipse/Java9: how to access internal javafx packages?
问题描述
我的上下文:
- 面向Java开发人员的Eclipse IDE,版本:Oxygen.1a发行版(4.7.1a),内部版本号:20171005 -1200oxygen
- jdk9.0.1
- win10
类似这样的简单
import com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler;
import javafx.application.Application;
import javafx.stage.Stage;
public class ImportCom extends Application {
@Override
public void start(Stage arg0) throws Exception {
new LambdaMultiplePropertyChangeListenerHandler();
}
}
不会
The type com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler is not accessible
该怎么办?
看起来类似,但现在用于内部类;)一直在进行编译,直到beta9支持的补丁530,但之后才进行编译-因此请保留旧的氧气作为黄金宝藏...
looks similar but now for internal classes ;) Had been compiling until patch 530 of the beta9 support but not after - so keeping that oldish oxygen as a gold treasure ...
注意:交叉发布到 eclipse论坛
编辑:
只是检查了javac on的行为命令行:
Just checked that the behavior of javac on the commandline:
C:\Users\kleopatra\ox-1a-64\dummy\src>\java\jdk\190-64\bin\javac first\ImportCom.java
first\ImportCom.java:3: error: package com.sun.javafx.scene.control is not visible
import com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler;
^
(package com.sun.javafx.scene.control is declared in module javafx.controls, which does not export it to the unnamed module)
1 error
错误类似于Eclipse中的错误。与--add-exports一起正常工作:
The error is similar to the one in Eclipse. Works fine with --add-exports:
C:\Users\kleopatra\ox-1a-64\dummy\src>\java\jdk\190-64\bin\javac --add-exports=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED first\ImportCom.java
所以问题归结为:在哪里/如何配置Eclipse,以便编译对内部的访问类与javac一样?
So the question boils down to: where/how to configure Eclipse such that it compiles access to internal classes just the same way as javac?
推荐答案
好吧,它有点隐藏:
- 打开项目的 Java构建路径对话框
- 选择库标签
- 选择 isModular 条目
- 使用 Edit ... 按钮打开模块属性对话框
- 选择详细信息选项卡
- 使用添加。按钮
- open Java Build Path dialog of the project
- select Libraries tab
- select isModular entry
- use the Edit... button to open the module properties dialog
- select Details tab
- create all required entries with the Add.. button
如果您已经安装了支持Java 9的Beta插件-请卸载。确保安装了最新的Java 9支持插件。
If you have installed the Beta plugin for Java 9 support - uninstall. Make sure the latest Java 9 support plugin is installed.
这篇关于Eclipse / Java9:如何访问内部javafx包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!