Closed PetrKaleta closed 9 years ago
@PetrKaleta I am not sure but I can see it. Loading AWT might push Java into some idea that it is going to be doing graphics. Off to the internets!
@enebo did you find something?
@PetrKaleta I might have a solution which will work. Java has a headless mode. In headless mode a series of AWT toolkit classes native impls are basically stubbed out. One side-effect is when headless it does not create the external window like you are seeing. So for batch processing:
jruby -J-Djava.awt.headless=true
or before image_voodoo is required:
java.lang.System.setProperty('java.awt.headless', true)
I am thinking about making a flag in bin/image_voodoo that detects whether preview is used and if so uses non-headless mode but without specifying this flag image_voodoo will by default be in headless mode. This has two points worth mentioning:
This is a big improvement. Thinking about this change a bit more I don't expect my fears of interactive users breaking will be real. For 1) are there any? :) and 2) If they are using AWT then it is extremely likely the first thing they load will be something else before image_voodoo in which case the headless property will have shown up too late to affect behavior.
I have this simple rake task:
Once I ran this task, it automatically runs Java application with empty window. So I loose focus from console, so then must switch windows etc... Can you prevent this? What is the reason to do that?