[J]
> (1) When using Swing, I would prefer that no console window was launched (like with Python's pythonw launcher)

[Alex]
> How are you deploying your app? I've NEVER seen a console (white on black, cli window)
> being launched with a java app. The Java console, however, can be disabled from the Java
> control panel. It's not enabled by default though.

I am deploying it as a Jython script (.jpy) on Windows XP.  The first time I double clicked on it, Windows asked me what program to run it with, I selected the jython.bat.  I put the script below in "Foo.jpy" and double clicked on it.  I get the JFrame as expected, but also a console window where jython would put prints (and I assume System.(out|err).prints) and where interpreter errors get logged.

Am I doing something profoundly dumb regarding deployment?

I have other Jython scripts which I invoke from the shell on UNIX, and behave as I would expect for both Python and Java programs.  But for front-end programs on Windows, it seems to expect a console to log to.  Python scripts using Tk have this same issue, which is why Python bundles a "pythonw" launcher to use instead.




#! /usr/bin/env jython

import sys

from javax.swing import JFrame, JLabel, JButton, UIManager, BoxLayout

def main(argv):

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

    f = JFrame()
    f.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
    f.contentPane.layout = BoxLayout(f.contentPane, BoxLayout.X_AXIS)

    f.add(JLabel("Hello World"))
    f.add(JButton("Button", actionPerformed=cb_Button))

    f.pack()
    f.visible = True

def cb_Button(event):
    pass

if __name__ == '__main__':
    main(sys.argv)