java9 javafx,Eclipse / Java9:如何访问内部javafx包?

My context:

Eclipse IDE for Java Developers, Version: Oxygen.1a Release (4.7.1a), Build id: 20171005-1200oxygen

jdk9.0.1

win10

Something simple like:

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();

}

}

won't compile due to

The type com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler is not accessible

What to do?

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 ...

Note: cross-posted to eclipse forum

Edit:

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

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

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?

解决方案

Well, it's a bit hidden:

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

If you have installed the Beta plugin for Java 9 support - uninstall. Make sure the latest Java 9 support plugin is installed.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值