Using println to debug JavaFX
By octav on Jan 28, 2009
Most of the developers that started programming in the 20th century, before IDEs were broadly used, are familiar with debugging using println statements. While I highly recommend that one uses NetBeans or Eclipse to develop JavaFX RIA applications, I believe certain people will still want to employ old techniques to debug their code.
Here is an example on how to use println in a JavaFX application to print environment variables.
There are a couple of tricks that you may have to be aware of.
- You can't use println while you initialize your code (between lines 18 & 34)
- println will send the output to the console
- If you want to print onto your UI artifact, you could employ the javafx.scene.text.Text object
- Printing environment variables may yield different results depending on your configuration. For instance, using the default - desktop app configuration will give you a different result than when you deploy the app to a mobile emulator