B4J Question Error : Not on FX application thread

ludogomez

Member
Licensed User
Longtime User
Hi,

I have this error when I start my jar, not in debug mode :

main._shserveur_stdout (java line: 958)
java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-5
at com.sun.javafx.tk.Toolkit.checkFxUserThread(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(Unknown Source)
at javafx.scene.Scene.addToDirtyList(Unknown Source)
at javafx.scene.Node.addToSceneDirtyList(Unknown Source)
at javafx.scene.Node.impl_markDirty(Unknown Source)
at javafx.scene.shape.Shape.impl_markDirty(Unknown Source)
at javafx.scene.Node.impl_geomChanged(Unknown Source)
at javafx.scene.text.Text.impl_geomChanged(Unknown Source)
at javafx.scene.text.Text.needsTextLayout(Unknown Source)
at javafx.scene.text.Text.needsFullTextLayout(Unknown Source)
at javafx.scene.text.Text.access$200(Unknown Source)
at javafx.scene.text.Text$2.invalidated(Unknown Source)
at javafx.beans.property.StringPropertyBase.markInvalid(Unknown Source)
at javafx.beans.property.StringPropertyBase.set(Unknown Source)
at javafx.beans.property.StringPropertyBase.set(Unknown Source)
at javafx.scene.text.Text.setText(Unknown Source)
at com.sun.javafx.scene.control.skin.TextAreaSkin.lambda$new$231(Unknown Source)
at com.sun.javafx.scene.control.skin.TextAreaSkin$$Lambda$143/345558392.invalidated(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.fireValueChangedEvent(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.markInvalid(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.invalidate(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.access$1300(Unknown Source)
at javafx.scene.control.TextInputControl.lambda$new$163(Unknown Source)
at javafx.scene.control.TextInputControl$$Lambda$74/566915750.invalidated(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.scene.control.TextArea$TextAreaContent.insert(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.doSet(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.set(Unknown Source)
at javafx.scene.control.TextInputControl.setText(Unknown Source)
at anywheresoftware.b4j.objects.TextInputControlWrapper.setText(TextInputControlWrapper.java:44)
at b4j.example.main._shserveur_stdout(main.java:958)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4j.objects.Shell$EventOutput.write(Shell.java:158)
at org.apache.commons.exec.StreamPumper.run(StreamPumper.java:106)
at java.lang.Thread.run(Unknown Source)


I use the jshell library and this error occur when I want to use the stdout with RunWithOuputEvents

Thanks

Regards
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
See the bold message:
SS-2014-10-28_16.50.25.png


You can use CallSubDelayed from this event. The target sub will run on the main thread.
 
Upvote 0

ludogomez

Member
Licensed User
Longtime User
Hi Erel,

I need an example,
I start a "executable" like a windows service with the jshell library and this executable don't stop at all. I listen the stdout to have some information.
When I start in debug mode, it's ok, but if I use the compiled jar in another computer, I have a crash.

I'm a neewbie and I don't understand the CallSubDelayed.

Thanks a lot

Best regards
 
Upvote 0

ludogomez

Member
Licensed User
Longtime User
Hi Erel,

it's OK, I understand my mistake. I don't install the good version of java on the PC.

Sorry for the noise.

Thanks

regards
 
Upvote 0
Top