Papp Zoltán
Papp Zoltán

Reputation: 181

VM option for ControlsFX

I have an exception when I use TextFields.bindAutoCompletion with JDK 11 and ControlsFX 11.0.0.

java.lang.IllegalAccessError: class org.controlsfx.control.textfield.AutoCompletionBinding (in module org.controlsfx.controls) cannot access class com.sun.javafx.event.EventHandlerManager (in module javafx.base) because module javafx.base does not export com.sun.javafx.event to module org.controlsfx.controls

I added option to javafx-maven-plugin maven plugin:

<plugin>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>0.0.8</version>
    <configuration>
        <mainClass>hu.infokristaly.jpasswordprotector.JPasswordProtector</mainClass>
        <options>
            <option>--add-exports</option>
            <option>javafx.base/com.sun.javafx.event=ALL-UNNAMED</option>
        </options>
    </configuration>
    <executions>
        <execution>
            <!-- Default configuration for running -->
            <!-- Usage: mvn clean javafx:run -->
            <id>default-cli</id>
        </execution>
        <execution>
            <!-- Configuration for manual attach debugging -->
            <!-- Usage: mvn clean javafx:run@debug -->
            <id>debug</id>
            <configuration>
                <options>
                    <option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000</option>
                </options>
            </configuration>
        </execution>
        <execution>
            <!-- Configuration for automatic IDE debugging -->
            <id>ide-debug</id>
            <configuration>
                <options>
                    <option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
                </options>
            </configuration>
        </execution>
        <execution>
            <!-- Configuration for automatic IDE profiling -->
            <id>ide-profile</id>
            <configuration>
                <options>
                    <option>${profiler.jvmargs.arg1}</option>
                    <option>${profiler.jvmargs.arg2}</option>
                    <option>${profiler.jvmargs.arg3}</option>
                    <option>${profiler.jvmargs.arg4}</option>
                    <option>${profiler.jvmargs.arg5}</option>
                </options>
            </configuration>
        </execution>
    </executions>
</plugin>

But exception still present. I searched with Google and I can't find working solution for this.

My module-info.java is bellow:

module hu.infokristaly.jpasswordprotector {
    requires javafx.controls;
    requires javafx.fxml;
    requires javafx.base;
    requires java.desktop;
    requires org.controlsfx.controls;
    requires com.google.gson;
    opens hu.infokristaly.jpasswordprotector to javafx.fxml;
    exports hu.infokristaly.jpasswordprotector;
}

Is this good?

Upvotes: 0

Views: 250

Answers (1)

Papp Zolt&#225;n
Papp Zolt&#225;n

Reputation: 181

I found a solution:

<configuration>
    <mainClass>hu.infokristaly.jpasswordprotector.JPasswordProtector</mainClass>
    <options>
        <option>--add-exports</option>
        í<option>javafx.base/com.sun.javafx.event=org.controlsfx.controls</option>
    </options>
</configuration>

And debug execution for NetBeans 12:

            <execution>
                <!-- Configuration for automatic IDE debugging -->
                <id>ide-debug</id>
                <configuration>
                    <options>
                        <option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
                        <option>--add-exports</option>
                        <option>javafx.base/com.sun.javafx.event=org.controlsfx.controls</option>
                    </options>
                </configuration>
            </execution>

Upvotes: 0

Related Questions