Note that there are some explanatory texts on larger screens.

plurals
  1. POSwing app doesn't display in some circumstances
    primarykey
    data
    text
    <p>I'm writing a utility to help with testing a much larger system, and my UI doesn't show up at all if I run it through the system. It works fine when I run it myself. More details:</p> <ol> <li>The system I'm testing has many processes, managed by a controller. When deployed, controller.exe spawns and terminates child processes, including my java app. When launched by the controller, my app runs fine (does work, generates logs, etc.) but the Swing UI doesn't render at all.</li> <li>I can launch my app myself from the command line, and the UI shows up just fine. According to Process Explorer, the Path, Command Line, and Current Directory are all identical to the values observed when the app is launched from the controller.</li> <li>When the app is invisble, clicking "Bring to Front" in Process Explorer pops a dialog that says. "No visible windows found for this process." Clicking the same button on the manually spawned process brings the Swing UI to front as expected.</li> <li>I'm testing this in Windows XP. The controller process runs under SYSTEM. I used the <a href="http://verbalprocessor.com/2007/12/05/running-a-cmd-prompt-as-local-system/" rel="nofollow">"at 09:45 /interactive cmd.exe" trick</a> to spawn a command prompt as SYSTEM for my manual launch. Process Explorer verifies that both methods (manual / controller) spawn the java process as SYSTEM.</li> <li>The only obvious difference between the two processes are the parents. The system process spawns as a child of controller.exe, while my manual executions are a child of cmd.exe.</li> <li>I have remotely debugged into the invisible process using using jdwp, and everything looks normal. The UI code executes, no exceptions are thrown, and my JLists are even getting populated with the data they monitor. As far as I can tell, everything works; I just can't see any of it.</li> </ol> <p>I apologize if this has been answered elsewhere. I did my best to search around, but all the questions I could find are about certain components failing to render, never a failure of the entire app to display.</p> <p>Thanks!</p> <p>Edits: Based on feedback, I've swapped in a demo program that's as small as possible. Here's the entire code:</p> <pre><code>import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class AceProbe { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame("Visible?"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(new JLabel("Test"), BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } }); } } </code></pre> <p>Running this from the command line displays the window as expected. However, when the controller spawns the process, nothing displays. When spawned by the controller, I can debug into the process remotely using <code>-agentlib:jdwp=transport=dt_socket,suspend=y,server=y,address=8000</code> and verify that all of the threads are spawning as expected, and that no exceptions are thrown.</p> <p>My intuition from here is that controller is in some odd graphics configuration and, since is parents the new java process, maybe Swing is not using the correct GraphicsDevice? I tried adding this code:</p> <pre><code>GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); for(GraphicsDevice d : ge.getScreenDevices()) { Log.println(d); for (GraphicsConfiguration c : d.getConfigurations()) { Log.println(c); Log.println(c.getBounds()); } } </code></pre> <p>The log contains this:</p> <pre><code>Win32GraphicsDevice[screen=0] sun.awt.Win32GraphicsConfig@13f459d[dev=Win32GraphicsDevice[screen=0],pixfmt=0] java.awt.Rectangle[x=0,y=0,width=1920,height=1080] </code></pre> <p>which seems to indicate there's only one device with one config, so I'm at a bit of a loss.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload