Problem running tests in module controls inside Eclipse

fastegal at swingempire.de fastegal at swingempire.de
Sun Nov 18 16:33:53 UTC 2018


okay, found something in the gradle tasks which point into direction  
of some success: it sets the stubtoolkit in a vm arg:

-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit

which does indeed work inside Eclipse if I add it to the runtime  
config of the test. Next step would be to set it globally somehow -  
adding in an arg file doesn't seem to work ... hmm ... probably  
something wrong with the exact format.

I have an arg file that sets the java.library path, named openjfx-args:

-Djava.library.path=C:\Daten\data-for-work\eclipse\gitrep-openjdk\openjdk-jfx-fork\modules\javafx.graphics\build\module-lib

if I add the toolkit param, it isn't taken:

-Djava.library.path=C:\Daten\data-for-work\eclipse\gitrep-openjdk\openjdk-jfx-fork\modules\javafx.graphics\build\module-lib
-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit

if I add it to the vm args of the jdk runtime environment (installed  
jres - open-11) all is fine:

vm args:
@openjfx-args -Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit

now all boils down to how to add two (or more) system properties to  
the arg file? darn ... back to roots ;)

Zitat von Nir Lisker <nlisker at gmail.com>:

> I don't recall seeing this problem. Just to be sure, did you circumvent the
> compilation error in Dialog's lambda?
>
> On Sun, Nov 18, 2018 at 5:42 PM <fastegal at swingempire.de> wrote:
>
>>
>> With the step-by-step debugging help provided by nlisker over at
>> javafxports (https://github.com/javafxports/openjdk-jfx/issues/187 -
>> which cleaned up some inherent misconception on my part, thanks!) I
>> managed to run tests in base and graphics from inside Eclipse (right
>> click and run as/unit test), but not in controls (complete stacktrace
>> is at the end), barking with essentially:
>>
>> Caused by: java.lang.IllegalStateException: Toolkit not initialized
>>
>> Which is the usual complaint if the fx app thread is not yet started.
>> For my own tests I have a class rule that fires it up, but how to
>> start it for openjfx controls tests?
>>
>> The complete stacktrace:
>>
>> java.lang.ExceptionInInitializerError
>>         at
>>
>> javafx.controls/test.javafx.scene.control.TextAreaTest.setup(TextAreaTest.java:53)
>>         at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>         at
>>
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>         at
>>
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>>         at
>>
>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>>         at
>>
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>>         at
>>
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>>         at
>>
>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
>>         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>>         at
>>
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>>         at
>>
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>>         at
>> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>>         at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>>         at
>>
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
>>         at
>>
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
>>         at
>>
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
>>         at
>>
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
>>         at
>>
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
>>         at
>>
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
>> Caused by: java.lang.IllegalStateException: Toolkit not initialized
>>         at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:410)
>>         at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:405)
>>         at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(PlatformImpl.java:695)
>>         at
>>
>> javafx.graphics/com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(PlatformImpl.java:657)
>>         at
>> javafx.controls/javafx.scene.control.Control.<clinit>(Control.java:99)
>>
>>
>>





More information about the openjfx-dev mailing list